Part Number Hot Search : 
U2508 ATAR890 SZ6051 SP14Q APL076 LPC47N BD159 HGL34M
Product Description
Full Text Search
 

To Download TMP90C051 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  toshiba toshiba corporation 1/184 tlcs-90 series TMP90C051 the information contained here is subject to change without notice. the information contained herein is presented only as guide for the applications of our products. no responsibility is assumed by toshiba for any infringements of patents or other rights of the third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of toshiba or others. these toshiba products are intended for usage in general electronic equipments (of?e equipment, communication equipment, measuring equipment, domestic electri?ation, etc.) please make sure that you consult with us before you use these toshiba products in equip- ments which require high quality and/or reliability, and in equipments which could have major impact to the welfare of human life (atomic energy control, spaceship, traf? signal, combustion control, all types of safety devices, etc.). toshiba cannot accept liability to any damage which may occur in case these toshiba products were used in the mentioned equipments without prior consultation with toshiba. cmos 8?it microprocessor TMP90C051f 1. overview and features the TMP90C051f is a high-speed 8-bit cmos microproces- sor with advanced functions and was developed for applica- tion in various types of device control. the TMP90C051f is a single-chip, 8-bit cmos micropro- cessor that integrates peripheral functions such as dma, dram controller, serial interface, timer/event counter and real time clock with an 8-bit cpu (tlcs90) core. memory area can also be extended up to 8m bytes depending on the mmu. the TMP90C051f features are as follows. (1) highly ef?ient instruction group number of basic instructions: 167 multiplication and division instructions, 16-bit arithmetic operation instructions and bit operation instructions. (2) minimum instruction execution times: 250ns (at 16.0mhz) (3) memory extension capability address space: 8m byte (max) (4) dma (2 channels) maximum transfer speed: 2-byte transfer; 0.88m byte/sec (at 16.0mhz) (5) dram controller (6) general-purpose serial interface (2 channels) uart (transmit/receive) i/o interface mode (transmit/receive) (7) thermal printer head (transmit) (8) 8-bit timer/event counter (4 channels) (9) real time clock: clock and calendar functions/battery backup capability. (10) stepping motor control pattern generation ports (2 channels) (11) input/output port (31-pin) (12) interrupt functions:11 internal, 9 external. (13) micro dma function maximum transfer speed: 0.34m byte/s (at 16.0mhz) (14) watchdog timer function (15) standby function (3 halt modes)
2/184 toshiba corporation TMP90C051 figure 1. TMP90C051f block diagram
toshiba corporation 3/184 TMP90C051 2. pin layout and functions this section shows the TMP90C051f pin layout diagram, and describes the input/output pin names and functions. 2.1 pin layout diagram figure 2.1 shows the TMP90C051f pin layout. figure 2.1. pin layout diagram (80-pin flat package) [top view]
4/184 toshiba corporation TMP90C051 2.2 pin names and functions table 2.2 shows the input/output pin names and functions. table 2.2 pin names and functions (1/3) pin name number of pins (pin no.) input/output or tristate function ad0 ~ ad7 8 (37 ~ 44) input/output or tristate lower address/data bus: used as both the lower 8-bit address bus (output) and data bus (bi-directional). a8 ~ a15 8 (45 ~ 52) output the upper 8-bit address bus. p20 ~ p26 (a16 ~ a22) 7 (54 ~ 60) output port 2: a 7-bit output port. outputs ??after reset. output address bus: the extension (upper) address bus. outputs ??after reset; there- fore, the TMP90C051f address area is 0 - 64k bytes until a value other than 000h is written to expa0 and expa1 of the mmu register group after a reset; therefore, a16 - a22 output zeros (0). when a logical address indicates within the local area (local 0 or local 1) range when the mmu is started, the physical addresses generated by the mmu are outputs to a16 - a22. zeros (0) are output to a16 - a22 when a logical address indicates within the common area (common 0 or common 1) range. when an indirect extension address area is accessed using the cpu index regis- ter the address value loaded to the bx or by register is output to a16 - a22. when data are transferred using high-speed micro dma, the address value loaded to the dma bank register is output to a16 - a22. rd 1 (62) output read: the strobe signal output used to read data from external memory. wr 1 (63) output write: the strobe signal output used to write data to external memory. w ait 1 (65) input wait: an input pin used to connect memory with slow access time and periph- eral lsis. nmi 1 (29) input non-maskable interrupt request pin: the input pin used to generate interrupt requests on the fall edges p30 (ras ) (1) (61) output port 30: a 1-bit output port. outputs ??after reset. ras: outputs the ras timing required for refreshing the dram of cas before ras. p31 (cas ) 1 (64) input port 31: a 1-bit output port. outputs ??after reset. cas: outputs the cas timing required for refreshing the dram of cas before ras. p32 (cs ) 1 (66) output port 32: a 1-bit output port. outputs ??after reset. chip select: the external memory chip select output pin. when a start address and area size are loaded to the control register in the dynamic ram controller, ??is output from the cs pin whenever the TMP90C051f accesses that address range. p33 (dact0 ) 1 (67) output port 33: a 1-bit output port. outputs ??after reset. dma active 0: outputs zeros (0) while data are being transferred via high-speed micro dma channel 0.
toshiba corporation 5/184 TMP90C051 table 2.2. pin names and functions (2/3) pin name number of pins (pin no.) input/outpu t or tristate function p34 (dact1 ) 1 (68) output port 34: a 1-bit output port. outputs ??after reset. dma active 1: outputs zeros (0) while data are being transferred via high-speed micro dma channel 1. p35 (wdtout) 1 (69) output port 35: a 1-bit output port. outputs ?dtout = 1?after reset. watchdog timer output: used as the wdtout output pin when watchdog timer mode register, d1 = 1. p36 (int7) 1 (70) input/output input port 36: a 1-bit output port. functions as an input port after reset. interrupt request pin 7: the input pin for generating interrupt requests at rise edges. p37 1 (71) input/output port 37: a 1-bit input/output port. functions as an input port after reset. p40 ~ p43 4 (7 ~ 10) input/output port 40 - 43: a 4-bit input/output port. functions as an input port after reset. output stepping motor control port 0. p50 ~ p53 (m10 ~ m03) 4 (11 ~ 14) input/output port 50 - 53: a 4-bit input/output port. functions as an input port after reset. output stepping motor control port 1 p60 ~ p63 (int3 ~ int6) 4 (15 ~ 18) input/output port 60 ~ 63: a 4-bit input/output port. functions as an input port after reset. input interrupt request pins 3-6: input pins for generating interrupt requests at rise edges. p64 (ti0) 1 (19) input/output port 64: a 1-bit input/output port. functions as an input port after reset. input timer input 0: the timer 0 clock input pin. p65 (ti2) 1 (20) input/output port 65: a 1-bit input/output port. functions as an input port after reset input timer input 2: the timer 2 clock input pin. p66 (to0/to1) 1 (22) input/output port 66: a 1-bit input/output port. functions as an input port after reset. output timer output 0/1: the timer 0 or timer 1 output pin. p67 (to2/to3) 1 (23) input/output port 67: a 1-bit input/output port. functions as an input port after reset. output timer output 2/3: the timer 2 or timer 3 output pin. latwait rxd0 1 (30) input set serial channel 0 to the tph mode after reset. the wait control input pin used to cause tphlat output to wait. used as the receive data input pin when serial channel 0 is set to the normal mode. tphsd (txd0) 1 (31) output serial channel 0 enters the tph mode and outputs ??after a reset. the tphsd pin is used to output transmit data to tph. when set to the normal mode, serial channel 0 functions as the transmit data output pin txd0 output immediately after mode is set. tphcko (sclk0) 1 (32) output after a reset, serial channel 0 enters the tph mode and outputs ?? the tphck0 pin is used to output the transmit clock to tph. input/output when set to the normal mode by the tph control register, serial channel 0 operates in the uart or i/o interface mode. the control register of serial channel 0 determines whether the uart or i/o interface mode is used. in the i/o interface mode, either the external clock from sclk0 or the transmit/receive clock from the internal baud rate generator is output. note: when operating with external clock inout in the i/o interface mode sclk0 is output after a reset; therefore, use an open drain circuit to connect the external clock to the sclk0 pin.
6/184 toshiba corporation TMP90C051 table 2.2 pin names and functions (3/3) pin name no. of pins (pin. no.) input/output or tristate function tphcki (rts0 ) 1 (33) input serial channel 0 enters the tph mode after a reset and functions to input the transmit clock to tph. output serial channel 0 is the tph control register and operates as the rts output pin when set to the normal mode. tphlat (cts0 ) 1 (34) output after a reset, serial channel 0 enters the tph mode and the functions as the latch signal pin for outputs to tph. input when set to the normal mode by the tph control register, serial channel 0 operates as the cts0 input pin. consequently, since the cts0 pin outputs after a reset, use an open drain circuit to connect the cts0 pin to cts0 when serial channel 0 is used in the uart mode. r ts1 1 (72) output the serial channel 1 rts1 output pin. cts1 1 (73) input the serial channel 1 cts1 input pin. sclk1 1 (74) input/output functions as the serial channel 1 transceive clock input or output pin. sclk1 functions as an input pin after a reset. txd1 1 (75) output the serial channel 1 transmit data output pin. rxd1 1 (76) input the serial channel 1 receive data input pin. cxin/cxout 2 (1/2) input/output used to connect the crystal oscillator for the real time clock. a 32.768khz crystal oscillator is usually connected. alarm 1 (3) output alarm: the output pin for alarms from the real time clock. comparator output and either the 16hz or 1hz signal generated by the divider can be output to the alarm pin using the alarm select circuit inside the real time clock. int0 ~ int2 3 (4~6) input interrupt request pins 0 - 2: the input pin used to generate interrupt requests at rise edges. int0 is an input pin with a schmitt circuit. ale 1 (35) output address latch enable signal: ad0 - ad7 addresses are latched on the fall of this signal. connected to external memory. ea 1 (28) input connect to gnd. clk 1 (24) output clock output: output a clock equal to the oscillation frequency divided by 4. pulled up during resets. reset 1 (23) input reset: the reset input pin used to initialize the TMP90C051f. (built-in pull up register) x1/x2 2 (26/77) input/output used to connect the crystal oscillator that generates the TMP90C051 internal system clock. v cc 2 (36/77) main power supply pin (+5v) baken 1 (79) input backup enable: set buken = 1 when the TMP90C051f main power supply vcc (pins 36/ 77) is +5v. set to bukrn = 0 to provide battery backup for the real time clock when the main power supply vcc (pins 36/77) is off. v cc (rtc) 1 (78) the real time clock backup power supply pin. arrange so that the same power is supplied to vcc (rtc) as to vcc (pins 36/77) when power is being supplied to vcc (pins 36/77). to provide battery backup for only the ral time clock, supply + 5v - 2v to vcc (rtc). v ss (gnd) 3 (25/53/80) gnd pin (0v)
toshiba corporation 7/184 TMP90C051 3. operation this section explains the functions and basic operations of the TMP90C051f by block. 3.1 cpu the TMP90C051f includes a high performance 8 bit cpu. for the function of the cpu, see the book tlcs 90 series cpu core architecture. this chapter explains exclusively the func- tions of the cpu of TMP90C051f which are not described in the the book. 3.1.1 reset figure 3.1 (1) shows the basic timing for the reset operation. to reset the TMP90C051f, it is necessary to maintain the reset input at ??for at least 10 system clocks (10 states: 2 microseconds with a 10mhz system clock) with the power supply voltage within the operating range and stable internal oscillator operation. when a reset is received, the address data bus (ad0 - ad7), address bus (a8 - a15), p36, p37, port 4 port 5 and port 6 are all set to input port status (high impedance). dedicated output port 2 (a16 - a22) ale is set to ?? p30 - p35, rd, wr and clk are set to ?? the other dedicated output ports are all set to ??and the dedicated input ports retain their current status. the cpu registers and external memory are not changed; however, the program counter pc, interrupt enable/disable ?g iff, bank registers bx and by are cleared to ?? the a regis- ter is indeterminate. when the reset is released, the instruction starts from address 0000h.
8/184 toshiba corporation TMP90C051 figure 3.1 (1). reset timing
toshiba corporation 9/184 TMP90C051 3.1.2 exf (exchange flag) for TMP90C051f, ?xf? which is inverted when the command ?xx?is executed to transfer data between the main register and the auxiliary register, is allocated to the ?st bit of memory address ffbfh. 3.1.3 wait control for TMP90C051f, a wait control register p2fr is allocated to the 2th and 3th bits of memory address ffdfh.
10/184 toshiba corporation TMP90C051 3.1.4 bank register for TMP90C051f, bx and by registers are allocated to mem- ory addresses ffech (bx register) ffedh (by register), respectively. in these registers, only the low-order 7 bits are valid, and the high-order 1 bit are unde?ed. these unde?ed bits become ??whenever they are read.
toshiba corporation 11/184 TMP90C051 3.2 memory map the TMP90C051f supports a program memory and a data memory of maximum 8m bytes. the program and data memory may be assigned to the address space from 00000h to 7fffffh. 3.2.1 internal i/o the TMP90C051f provides a 128-byte address space as an internal i/o area, whose addresses range from ff80h to ffffh. this i/o area can be accessed by the cpu using a short opcode in the ?irect addressing mode? figure 3.2 (1) is a memory map indicating the areas accessible by the cpu in the respective addressing mode. figure 3.2 (1). memory map
12/184 toshiba corporation TMP90C051 3.3 interrupt functions the TMP90C051f has a general-purpose interrupt process- ing routine for responding to both internal and external inter- rupt requests, a micro dma processing mode in which the cpu automatically transfers data, and a high-speed micro dma (hdma) processing mode. immediately after a reset is released, all responses to interrupt requests are set to the general-purpose interrupt processing mode. the interrupt requests can be set to the micro dma processing mode with the dma enable/disable register which is described later. the high-speed dma processing mode can be set by loading a vector value to the dmav 0/1 register. figure 3.3 (1) shows the interrupt response ?w. figure 3.3 (1). interrupt response flow when an interrupt request is generated, this is reported to the cpu via the built-in interrupt controller. if the request is for a non-maskable interrupt or an enabled maskable interrupt, the cpu starts interrupt processing. if for a disabled maskable interrupt, the request is ignored and not received. if the interrupt is received, the cpu ?st reads the interrupt vector from the built-in interrupt controller to determine the source of the interrupt request. next, a check is made as to whether this request is for general-purpose interrupt processing, micro dma processing or high-speed dma (hdma) processing, and then the corre- sponding pr ocessing is performed. the interrupt vector is read in an internal operation cycle so the bus cycle becomes a dummy cycle.
toshiba corporation 13/184 TMP90C051 3.3.1 general-purpose interrupt processing figure 3.3 (2) shows the general-purpose interrupt processing ?w. the cpu ?st saves the contents of the program counter pc and register af (including the interrupt enable/disable ?g iff immediately before an interrupt) to the stack and then resets the interrupt enable/disable ?g iff to ??(interrupt disable). finally, the interrupt vector contents [v] are transferred to the program counter and a jump is made to the interrupt processing pr ogram. there is a 20-state overhead from the time when the interrupt is received until the jump is made to the interrupt processing program. figure 3.3 (2). general-purpose interrupt processing flow interrupt processing program is ended with the reti instruction for both maskable and non-maskable interrupts. executing this instruction restores the program counter pc and register af contents from the stack. (resets the interrupt enable/disable ?g immediately before an interrupt.) when the cpu reads the interrupt vector, the interrupt request source con?ms that the interrupt has been received and then clears the interrupt request. non-maskable interrupts cannot be disabled by program. maskable interrupts, how- ever, can be enabled and disabled by program. bit 5 of cpu reg- ister f is an interrupt enable/disable ?p?p (iff). interrupts are enabled by setting this bit to ??with the ei (interrupt enable) instruction and disabled by resetting this bit to ??with the di (interrupt disable) instruction. iff is reset to ??by resetting and when an interrupt is received (including non-maskable interrupts). the ei instruction is actually executed after the next instruction is executed. table 3.3 (1) shows the interrupt sources.
14/184 toshiba corporation TMP90C051 note: * hdma supports all maskable interrupts. table 3.3 (1) interrupt sources priority sequence type interrupt function name interrupt vector value general- purpose interrupt processing start address micro dma support micro dma processing parameter start address interrupt sources comments internal external 1 2 non- maskable s w i instruction nmi 08h 10h 0008h 0010h o nmi pin 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 maskable (hdma) int0 int1 int2 intt0 intt1 intt2 intt3 intrx0 inttx0 intline intrx1 inttx1 intalarm int3 int4 int5 int6 int7 18h 20h 28h 30h 38h 40h 48h 50h 58h 60h 68h 70h 78h 80h 88h 90h 98h a0h 0018h 0020h 0028h 0030h 0038h 0040h 0048h 0050h 0058h 0060h 0068h 0070h 0078h 0080h 0088h 0090h 0098h 00a0h o o o o o o o o o o o o ff18h ff20h ff28h ff30h ff38h ff40h ff48h ff50h ff58h ff60h ff68h ff70h timer 0 timer 1 timer 2 timer 3 serial receive end serial send end tph send serial receive end serial receive end alarm output int0 pin int1 pin int2 pin int3 pin int4 pin int5 pin int6 pin int7 pin * 1 external 0 external 1 external 2 timer timer timer timer sio sio tph sio sio rtc external 3 external 4 external 5 external 6 external 7 the ?riority sequence?shown in table 3.3 (1) indicates the sequence in which interrupt sources are received by the cpu when multiple interrupt requests are generated simulta- neously. for example, if interrupt requests with the priority sequences 4 and 5 are generated simultaneously, the cpu will receive the interrupt request with priority sequence 4 ?st. when processing of the interrupt with priority sequence 4 is ended with the reti instruction, the cpu will then receive the interrupt with priority sequence 5. if the interrupt processing program for the priority sequence 4 interrupt is interrupted by executing the ei instruction, the cpu will receive the priority sequence 5 interrupt request. when multiple interrupt requests are generated simultaneously, the built-in interrupt controller only determines the priority sequence of the interrupt sources received by the cpu. there is no function to compare the priority sequence of the interrupt currently being processed and the interrupt currently being requested. another interrupt can be enabled while another interrupt is being processed by resetting the interrupt enable/disable ?g iff to enable. 3.3.2 micro dma processing figure 3.3 (3) shows the micro dma processing ?w. the cpu ?st loads the parameters (transfer source and destination addresses, transfer mode) required for transferring data between memories from the address modi?d by the interrupt vector value and then transfers the data between memories in accordance with those parameters. after that, the revised parameters are saved to the original location. the transfer count is then decremented and, if the value is not ?? micro dma processing is ended. if the value is ?? the general-purpose interrupt processing described in the previous item is performed. the transfer count is decremented by ?1?each time the micro dma starts up. *1)
toshiba corporation 15/184 TMP90C051 figure 3.3 (3). micro dma processing flow since most interrupt processing involves only simple data transfers, micro dma processing uses only the hardware for such processing. consequently, micro dma processing is faster than conventional software processing. naturally, there is absolutely no in?ence on the cpu registers from the micro dma processing. figure 3.3 (4) shows the functions of the parameters used in the micro dma processing.
16/184 toshiba corporation TMP90C051 figure 3.3 (4). micro dma processing parameters the parameters used for the micro dma processing are located in the external ram area (see table 3.3 (1) interrupt sources). the start address of each micro dma processing parameter is [ff00h + interrupt vector value], 6 bytes of which are used for the parameters. when the micro dma processing mode is not used, this area can be used as user memory. the parameters include transfer count, transfer destination address, transfer source address and transfer mode. transfer count speci?s the number of times data will be transferred by micro dma processing. either 1 or 2- bytes of data are trans- ferred at one time by micro dma processing. data are transferred 256 times with a transfer count of ?0h? the addresses 0000h - ffffh are used in micro dma processing (at not use mmu function). bits 0 and 1 specify the transfer destination or transfer source address change mode. bit 2 speci?s the length (1 or 2 bytes) of the data handled. table 3.3 (2) shows the relationship between the transfer mode and transfer destination/transfer source address incre- ment/decrement values. table 3.3 (2) micro dma processing address changes transfer mode function transfer destination address transfer source address 000 001 010 011 100 101 110 111 transfers 1-byte, ?es transfer destination/source addresses. transfers 1-byte, increment s transfer destination address. transfers 1-byte, increment transfer source address. transfers 1-byte, decrement transfer source address. transfers 2-bytes , ?es the current destination/source addresses. transfers 2-bytes , increment transfer destination address. transfers 2-bytes, increment transfer source address. transfers 2-bytes, decrements, transfer source address. 0 +1 0 0 0 +2 0 0 0 0 +1 -1 0 0 +2 -2
toshiba corporation 17/184 TMP90C051 data are transferred as shown below in the 2-byte transfer mode. (transfer source address) ? (transfer destination address) (transfer source address + 1) ? (transfer destination address + 1) transfers are also performed as shown above in ?ecrement transfer source address mode?but address changes are as shown in table 3.3. address incrementation and decrementation are used for the memory area but ?ed addresses are used for ordinary input/ output addresses. because of that, micro dma was designed taking into consideration input/output to memory and memory to input/output transfers. figure 3.3 (5) shows and example using the micro dma processing mode. built-in serial input/output receive data are processed in the example. in the example, 7 frames (1 frame = 1 byte in this example) of received data are stored to memory address ff00h - ff06h and when all of the data have been received, the ?eceive end processing program?is executed. figure 3.3 (5). micro dma processing example ?able 3.2 bus operations for each instruction?above shows the bus operation for general-purpose interrupt pro- cessing and micro dma processing. the execution time (when the transfer count is not 0 after decrementation) for micro dma processing is 46 states (9.2 microseconds at 10mhz), regardless of whether the 1-byte or 2-byte transfer mode is used.
18/184 toshiba corporation TMP90C051 3.3.3 high-speed micro dma processing the TMP90C051f has two built-in dma channels called hdma. hdma has three times the processing capacity of m dma and is used for high-speed data transfers. hdma execution time (decrease the value of transfer number and the value is not ??data) is 14 states, regardless of whether the 1-byte transfer mode or 2-byte transfer mode is used. hdma and micro dma transfer speeds. table 3.3 (3) shows the high-speed micro. * at 1-byte transfer mode. table 3.3 (3) transfer speeds fxtal (mhz) hdma micro dma 10 2.8 m s 9.2 m s 12.5 2.24 m s 7.36 m s 16 1.75 m s 5.75 m s table 3.3 (4) shows the hdma function number of channels 2 transfer speed 14 states (for 1 byte) or 18 states (for 2 bytes) start method by interrupt (all external and internal interrupt sources) transfer mode 1 byte transfer or 2 byte transfer address output method dual address (source/destination) access area 0 ~ 8-m byte memory area (64k-byte units) (1) hdma setting registers the following describes the registers required for hdma operation. (a) dmas0, 1: source address register (16-bit) (b) dma0, 1: destination address register (16-bit) (c) dmac0, 1: byte count register (16-bit) sets the number of bytes to be transferred. the set value is decremented (?) for each hdma started. a generation purpose interrupt is when the value reaches ??
toshiba corporation 19/184 TMP90C051 note: it is ineffective to set decrement for a destination address when a source address being increment; and to set increment for a destination address when a source address being decrement. (d) dmam0, 1: transfer mode register (8-bit) this register determines the hdma transfer mode. the bits of this register are as shown in the table above. the source and destination addresses shown here are the addresses loaded to dmas0, 1 and dmad0, 1 above. example 1 : xxx00001 transfers 1 byte, ?es transfer source address (dmas0, 1), and increments the transfer destination address after each transfer. example 2: the renewal of address at 2 byte transfer mode.
20/184 toshiba corporation TMP90C051 (e) dmasb0, 1: source address bank register source address extension register used as a pair with the dmas0, 1 register, this bank register is speci?d for addresses for 64k bytes or more. this register has no increment or decrement function; therefore, it is necessary to exercise caution in specifying variable addresses (increment or decrement) with the above mode register. (f) dmadb0, 1: destination address bank register
toshiba corporation 21/184 TMP90C051 destination address register used as a pair with the dmad0, 1 register. the function are the same as those of the dmasb0/1. (g) dmav0, 1: dma vector register hdma is started by interrupts. consequently, the vector address of the interrupt that assigns hdma start is loaded to the dma vector register (dmav0/1). hdma compares the interrupt vector and the contents of this register. if they match, hdma operation starts. it is necessary to set the vector address before gener- ating the interrupt that starts hdma. (2) register loading (a) dmas0, 1 dmad0, 1 loaded with the ldc instruction. dmac0, 1 (*the ldc instruction is a new tlcs-90 1 instruction.) dmam0, (b) dmasb0, 1 dmadb0, 1 load the input/output address with the ld instruction. dmav0, 1 (see the separate address map concerning input/output addresses.) (3) hdma start hdma can be started by any of the TMP90C051 maskable interrupt sources. (a) internal start factors ?swi (software) ?all internal i/o interrupts assign starting of hdma channel 0 or channel 1 to the int0 - int7 external interrupts, connect any of the bits of ports 2 - 6 (output mode) externally to int0 - int7 to generate a start interrupt. (b) external start factors ?nmi pin ?int0 ~ 7 pin (4) hdma channel 0 and channel 1 priority sequence the channel where an interrupt is generated ?st has priority. note: hdma, regardless of an interrupt enable ?g, compares the vector and the values of the dma v0/1 register. if they match in ei mode, the hdma starts. do not write the vector value of the non-maskable interrupt to the dma v0/1 register. if doing so, the hdma does not operate normally. to stop the hdma being started, set di mode before generating the interrupt to start the hdma, or set the dma v0/1 register to 00h.
22/184 toshiba corporation TMP90C051 (5) hdma operation flow figure 3.3 (6). hdma operation flow
toshiba corporation 23/184 TMP90C051 (6) hdma operation timing (a) 1-byte transfer mode figure 3.3 (7a). hdma operating timing
24/184 toshiba corporation TMP90C051 (b) 2-byte transfer mode figure 3.3 (7b). hdma operation timing
toshiba corporation 25/184 TMP90C051 3.3.4 interrupt controller figure 3.3 (9) shows an abbreviated interrupt circuit diagram. the left half of this diagram shows the interrupt controller and the right half shows the cpu interrupt request signal circuit and hold release circuit. the interrupt controller has an interrupt request ?p?p and interrupt enable/disable ?g for each interrupt channel (total: 20 channels), and a micro dma enable/disable ?g. the interrupt request ?p-?p latches interrupt requests that arrive from the periphery. this ?p?p is reset to ??when there is a reset, when the cpu receives an interrupt and reads the vector of that interrupt channel, and when an instruction that clears the interrupt request (writes ?ector value/8?to memory address ffc9h) for that channel is executed. ld (0ffc9h), 38h/8 for example, when ld (0ffc9h), 38h / 8 is executed, the interrupt request ?p?p for the interrupt channel [intt1] with the vector value 38h is reset to ??(to clear the ?p?p, also write to address ffc9h when the interrupt request ?g is assigned to ffcah and ffcbh). table 3.3 (5) shows the ?nterrupt vector value/8?values. the status of the interrupt request ?p?p can be determined by reading memory address ffc9h, ffcah or ffcbh. ?? means no interrupt request and ??means an interrupt request. figure 3.3 (8) shows the bit layout when the interrupt request ?p?p is read.
26/184 toshiba corporation TMP90C051 figure 3.3 (8). interrupt request flip?p read (1/2) table 3.3 (5) interrupt vector value/8 values priority sequence type interrupt function name interrupt vector value vector value ? 8 1 2 non maskable swi instruction nmi 08h 10h 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 maskable (hdma) int0 int1 int2 intt0 intt1 intt2 intt3 intrx0 inttx0 intline intx1 inttx1 intalarm int3 int4 int5 int6 int7 18h 20h 28h 30h 38h 40h 48h 50h 58h 60h 68h 70h 78h 80h 88h 90h 98h a0h 03h 04h 05h 06h 07h 08h 09h 0ah 0bh 0ch 0dh 0eh 0fh 10h 11h 12h 13h 14h
toshiba corporation 27/184 TMP90C051 figure 3.3 (8). interrupt request flip?p read (2/2)
28/184 toshiba corporation TMP90C051 figure 3.3 (9). interrupt controller block
toshiba corporation 29/184 TMP90C051 the interrupt enable/disable ?gs for each interrupt request channel are assigned to memory addresses ffcc - ffceh. interrupts are enabled for a channel by setting the ?g to ?? the ?gs are reset to ??by resets. disable interrupts (di) before clearing the interrupt request ?gs. the micro dma enable/disable ?gs for each interrupt request channel are assigned to memory addresses ffceh or ffcfh. the interrupt requests for a channel are set to the micro dma processing mode by setting the ?g to ?? the ?gs are reset to ??by resets (??is the general-purpose inter- rupt pr ocessing mode). figure 3.3 (9) shows the bit layouts for the interrupt enable/disable ?gs and micro dma enable/disable ?gs. disable interrupts (di) before clearing the interrupt request ?gs. caution is required in usage because the two following points are exceptions. intrx0, intrx1 interrupt request flipflops are cleared only by resets and reading the serial channel receive buffer. they are not cleared by instructions. int0 ~ int7 int0 ~ int7 are all of the edge type.
30/184 toshiba corporation TMP90C051 figure 3.3 (10). micro dma interrupt enable flags (1/2)
toshiba corporation 31/184 TMP90C051 figure 3.3 (10). micro dma interrupt enable flags (2/2)
32/184 toshiba corporation TMP90C051 figure 3.3 (11). overall interrupt processing flow
toshiba corporation 33/184 TMP90C051 3.4 mmu 3.4.1 address area extension the TMP90C051f can access the extended address area (10000h -7fffffh) using the following three methods. addr ess extension method (1) extended data area access using cpu bank registers bx and by. (2) extended data area access during hdma (high-speed dma) transfers (source addresses bank register: dmas0 and dmas1; destination address bank register: dmadb0 and dmadb1). (3) extended program area and extended data area access by the mmu. as shown in ?ure 3.4 (1), the TMP90C051f can also use cllar (common local logical address register) of the mmu to specify common 0, local 0, common 1 and local 1 areas in the logical area at address 0000h - ffffh. table 3.4 (1) shows in what areas of the logical address area the above three methods can be used. figure 3.4 (1). logical area speci?ation table 3.4 (1) address extensions for each area of the logical area logical area bx, by mmu dmasb0/1, dmadb0/1 common 0 o x o local 0 o o o local 1 o o o common 1 o x o
34/184 toshiba corporation TMP90C051 i) extended data ar ea access using the cpu bank r egisters bx and by ix, iy , bx and r egisters ix and iy are independent 16-bit registers called index registers. bx and by are independent 7-bit registers called bank registers. these registers are mainly used to specify memory addresses and to generate 23-bit addresses. the ix and iy registers are also used as 16-bit addition instruction registers. the bx and by registers are assigned to address ffech (bx register) and address ffedh (by) in the built-in input/output register area. only the lower 7 bits of these registers are effective; the uppermost bit is unde?ed. this unde?ed bit is always read as ?? the lower 7 bits of the bx and by registers are initialized to ??by resets. extended data ar ea addr essing mode the TMP90C051f can use up to 8m bytes of data memory. addresses 0000000h - 00ffffh can be accessed in the normal addressing mode. addresses 010000h - 7fffffh are called the extended data area and are accessed in a special addressing mode. to access the extended data area, an addressing mode (a mode that uses the register indirect addressing mode register pair ix or iy, or a mode that uses the index addressing mode register pair ix or iy) that uses the index addressing mode register pair ix or iy to calculate the operand address. thus, there are four types. (ix) (iy) (ix + d) (iy + d) in these modes, the 23-bit address required for accessing the extended data area consists of a 16-bit offset (address bus a0 - a15) and a 7-bit bank address (address bus a16 - a22). the 16-bit offset is the same as the calculated value of the conventional address. the 7-bit bank address is speci?d with bank register bx or by. bx is used to form a pair in modes that use the index register ix. by is used to form a pair in modes that us the index register iy. note: when the extended data area addressing mode is used with the jr or call instruc- tion, the value of the bank register that cor- responds to that index register must be ?? these instruction cannot use in expand memory area at mmu.
toshiba corporation 35/184 TMP90C051 example: ld a, (ix) memory data 45h at address 062000h is loaded to the a register. in the index addressing mode, carries resulting from calculation of 16-bit offsets are ignored. there is no effect on the bank registers. example: ld a, (iy + 23h) memory data 45h at address 060013h is loaded to the a register. in addressing modes (modes that do not use index register ix or iy to calculate the operand address) that do not access the extended data area, the 7-bit bank register (address bus a16 - a22) becomes ??and the address range 000000h - 00ffffh can then be accessed. note: when this addressing mode is used by the transfer destination, this write cycle is not per- formed correctly when the actual address is bank register address ffech or ffedh. example: ld (ix), 05h when the ix value is ffech and bx value is ??
36/184 toshiba corporation TMP90C051 ii) extended data ar ea access during hdma transfer during hdma transfers, memory addresses are indicated by the values loaded to the hdma source address register (dmas0 and dmas1) and destination address register (dmad0 and dmad1). for extended data area access, memory addresses are indicated by the values loaded to the source bank register (dmasb0 and dmasb1) and destination bank register (dmadb0 and dmadb1). figure 3.4 (2). source address/destination address speci?ation during hdma transfer figure 3.4 (3). typical hdma data transfer between banks ( ? ~ - )
toshiba corporation 37/184 TMP90C051 iii) pr ogram ar ea and data ar ea expansion using the mmu function the TMP90C051 offers program area and data area expansion, depending on the mmu. ? mmu not used : program area 0 - 64kb : data area 0 - 64kb : when bx and by/hdma are used 0 - 8mb ? mmu used : program area 0 - 8mb : data area 0 - 8mb 3.4.2 mmu functions the following register expand the 64kb logical memory capacity (address 0000h - ffffh) to a maximum of 8mb (addresses 000000h - 7fffffh). (1) cllar: common local logical address register (14-bit) (2) expa0: local 0 expand register (11-bit) (3) expa1: local 1 expand register (11-bit) cllar is used to specify the logical addresses 0000h-ffffh in the common 0, local 0, local 1and common 1 areas, as shown in figure 3.4 (1). expa0 is a bank register used to map the local 0 area logical addresses speci?d with cllar to the physical address space. when the program area or data is indicated as being inside the local 0 area, the expa0 value is added to either the current program address value or memory address value to generate the physical addresses. expa1 functions in the same way as expa0.
38/184 toshiba corporation TMP90C051 figure 3.4 (4). address expansion by mmu (4kb units)
toshiba corporation 39/184 TMP90C051 (1) cllar (common and local logical address register) figure 3.4 (5). con?uration as shown in figure 3.4 (5), cllar has a 14-bit con?u- ration (8 lower bits and 6 upper bits). the start addresses of common 0, local 0, local 1 and common 1 in the logical address area shown in figure 3.4 (4) are speci?d with cllar. that is, up to 4 address areas can be speci?d with cllar. when the 16-bit transfer instruction is used, locs and com1 are the upper addresses and loc1 and loc0 are the lower addresses of the cllar setting. locs and com1, loc1 and loc0 can also be set indi- vidually with 8-bit transfer instructions. cllar can be read and written with either 8-bit or 16-bit transfer instructions. i) locs (local size ) this register speci?s the minimum local 0 and local 1 unit (size).
40/184 toshiba corporation TMP90C051 ii) com1, loc1 and loc0 (common and local start addr esses ) these registers specify the 4 upper bits of the start addresses of common 1, local 1 and local 0 in the 0000h - ffffh logical address area. since the minimum unit for the com1, loc1 and loc0 areas is determined by locs, the start address of each area is as shown in figure 3.4 (6). after a reset, com1 = eh, loc = eh and loc0 = 0h. note: the minimum unit for the area size is deter- mined by locs, and de?ed by the start address of each area. setting example: (the minimum unit : 4k byte) when locs = 00h loc0 = 01h loc1 = 08h com1 = 0fh
toshiba corporation 41/184 TMP90C051 figure 3.4 (6). local size (locs) and start address speci?ation
42/184 toshiba corporation TMP90C051 iii) addr ess ar ea speci cation and types in the logical address area (0000h - ffffh), the address areas are set using the common and local register (cladr) as shown below. mmu will not operate correctly if any combination not shown here is used. always set the cladr register to com1 3 loc1 3 loc0. note: com1, loc1 and loc0 are set to match the local size (locs) as shown below.
toshiba corporation 43/184 TMP90C051 (2) expa0 (expand register 0) and expa1 (expand register 1) figure 3.4 (7). exp0, expa1 con?uration expa0 is set to map the logical address area in local 0 to the physical address area when the local 0 address area is accessed by the cpu. all bits are set to ??by resets. expa1 is set to map the logical address area in local 1 to the physical address area when the local 1 address area is accessed by the cpu. all bits are set to ??by resets. for both expa0 and expa1, the 16-bit transfer instruction loads the upper address bits to a22 - a20 and the lower address bits to a19 - a12. loading is also possible with 8-bit transfer instructions. both expa0 and expa1 can be read and written. use the common area (in the logical address area) to write overwrite expa0 and expa1. when loading to the logical address area, the contents of expa0 and expa1 are mapped to the physical address area immediately after the instruction used to load is executed. note: when overwriting expa0 and expa1 in the physi- cal address area, use caution concerning the addresses in the physical address area to which the addresses in the current logical address area are mapped. this is because the addresses are mapped to a different physical address area immediately after the instruction used to over- write is executed.
44/184 toshiba corporation TMP90C051 (3) physical address area speci?ation when a program area is located above 64k bytes (0000h - ffffh), the logical address area can be mapped to the physical address area by accessing the local 0 and local 1 address area speci?d with the common and local address register. when mapping to the physical area, the address is indicated by adding the values of the local 0 expand register (expa0), local 1 expand register (expa1) and the logical addresses in the local 0 and local 1 area. when a program is executed in a common area, zeros are output to a22 - a20 and the logical address is output to a12 - a15. physical addr ess generation figure 3.4 (8). physical address generation using 4k-byte units figure 3.4 (9). physical address generation using 8k-byte units
toshiba corporation 45/184 TMP90C051 figure 3.4 (10). physical address generation using 16k-byte units
46/184 toshiba corporation TMP90C051 3.4.3 mmu usage (software) (1) typical mmu setting figure 3.4 (11). after reset figure 3.4 (12). typical mmu settings ?1
toshiba corporation 47/184 TMP90C051 figure 3.4 (13). mmu settings ? figure 3.4 (14). mmu settings ?
48/184 toshiba corporation TMP90C051 3.5 standby functions executing the halt instruction sets the TMP90C051 to the run, idle1 or stop mode, depending on the contents of the halt mode setting register. the features are shown below. (1) run: only the cpu halts, power consumption remains the same. (2) idle: only the internal oscillators operate, all others internal circuitry halts. power consumption is 1/10 or less of that during operation. (3) stop: all internal circuitry halts, including the oscillators. power consumption is extremely reduced. the halt mode setting wdmod is assigned to bits 2 and 3 memory address ffddh in the built-in input/output register area (all other bits are used to control other block functions). the ?0?run mode is set by resets. the halt status is released by interrupt requests and resets. if interrupts are enabled, the cpu receives non-maskable and maskable interrupts and starts interrupt processing. if maskable interrupts are disabled, the cpu restarts execution from the instruction following the halt instruction but the interrupt request ?g remains at ?? if the halt status is released by reset, however, use caution since the status in effect before entering the halt status cannot be maintained. in such cases, it is recommended that inter- rupt requests be used for releasing. figure 3.5 (1). halt mode setting register
toshiba corporation 49/184 TMP90C051 3.5.1 run mode figure 3.5 (2) shows the timing used to release halts using interrupts in the run mode. in the run mode, the system clock in the mcu does not stop after the halt instruction is executed; the cpu merely stops executing instructions. that is, the cpu repeats dummy cycles until the halt status is released. in the halt status, interrupt requests are sampled at clk signal falls. figure 3.5 (2). halt release timing using interrupts in the run mode *: halt status can be released with external interrupts (int1 - int7) only in the run mode.
50/184 toshiba corporation TMP90C051 3.5.2 idle mode figure 3.5 (3) shows the timing used to release halts with interrupts in the idle mode. in the idle mode, only the internal oscillator operations, TMP90C051f system clock stops and the clk signal is ?ed at ?? in the halt mode, interrupt requests are sampled asynchro- nously with the system clock but sampling is performed synchro- nously when the halt mode is released. note: in this mode, only external interrupt (nmi and int0) are enabled during the halt interval. figure 3.5 (3). halt release timing using interrupts in the idle mode
toshiba corporation 51/184 TMP90C051 3.5.3 stop mode in the stop mode, all internal circuitry stops, including the internal oscillator. when the stop mode is activated, all but certain pins are isolated from TMP90C051f by being set to high impedance. all interrupt requests are disabled during the hat interval in this mode (leave the external non-maskable interrupt pin (nmi) at the ??level). consequently, this mode can only be released by resetting. ports with programmable pull-up resistance remain pulled up. table 3.5 shows the status of each pin in the stop mode. the status in effect before the halt continues if wdmod (drive enable: bit 0 of memory address ffddh) of the built-in input/output register is set to ?? this register is cleared to ??by resets. the internal oscillator can also be restarted by inputting the reset signal ??to the cpu; however, operation is sometimes not correct after power-on due to clock instability immediately after the internal oscillator restarts. when releasing a halt by resetting in the stop mode, it is necessary to keep the reset signal at ??for a suf?ient time. the internal oscillator also restarts by entering the reset signal ??to the cpu; however, the warming up counter does not operate due to quick power-on operation. because of clock instability immediately after restarting the internal oscillator, the cpu may not operate correctly. when releasing a halt by resetting in stop mode, the reset signal must be kept at ?? for a suf?ient time. figure 3.5 (4). halt release timing using interrupts in the stop mode
52/184 toshiba corporation TMP90C051 : indicates that input mode/input pin cannot be used for input and that the output mode/output pin have been set to high impedance. in : the input gate is operating. fix the input voltage at either ??or ??to prevent the pin ?ating. out : the output status. in : the input status. table 3.5 state of pin in stop mode in/out drzve = 0 drzve = 1 ad0 ~ ad7 3 state a8 ~ a15 out pin out p20 ~ p26 out pin out p30 ~ p35 out pin out p36 ~ p37 input mode output mode in out p4 input mode output mode out in out p5 input mode output mode out in out p6 input mode output mode in out ale output pin ? ? clk output pin ? reset input pin in in x1 input pin x2 output pin ? ? rd output pin out wr output pin out wait input pin in nmi input pin in in int0 input pin in in int1 ~ 2 input pin - in latwait /rxd0 input pin in tphsd/txd0 output pin out tphcko/sclk0 input mode output mode in out tphcki/rts0 input mode output mode in out tphlat /cts0 input mode output mode in out rxd1 input pin in txd1 output pin out sclk1 input mode output mode in out rts1 output pin out cts1 input pin in baken input pin in in cxin input pin in in cxout output pin out out alarm output pin out out
toshiba corporation 53/184 TMP90C051 3.6 function of ports the TMP90C051f contains a of total 31 bits input/output ports. these ports function not only for the general-purpose i/ o but also for the input/output of the internal cpu and i/o. table 3.6 describes the functions of these ports. table 3.6 functions of ports port name pin name no. of pins direction direction set unit pin name for internal function port 2 p20 p21 p22 p23 p24 p25 p26 1 1 1 1 1 1 1 output output output output output output output a16 a17 a18 a19 a20 a21 a22 port 3 p30 p31 p32 p33 p34 p35 p36 p37 1 1 1 1 1 1 1 1 output output output output output output i/o i/o ras cas cs dact0 dact1 wdtout int7 port 4 p40 ~ p43 4 i/o bit m00 ~ m03 port 5 p50 ~ p53 4 i/o bit m10 ~ m113 port 6 p60 p61 p62 p63 p64 p65 p66 p67 1 1 1 1 1 1 1 1 i/o bit int3 int4 int5 int6 ti0 ti2 to0/to1 to2/to3 these port pins function as the general-purpose input/ output ports by resetting. the port pins, for which input or output is programmably selectable, function as input ports by resetting. a separate program is required to use them for an internal function.
54/184 toshiba corporation TMP90C051 3.6.1 port (p20 - p26) port 2 is a 7-bit general-purpose output port (p2: memory address ffb4h). p20 - p26 are used both as output only ports and as the expansion address bus (a16 - a22). the control register p2cr: memory address ffb5h) is used to specify which mode is to be used. reset operations clear the p20 - p26 out- put latch and all control register bits to ??to set p20 - p26 to the general-purpose output port mode. figure 3.6 (1). port 2 (p20 - p26)
toshiba corporation 55/184 TMP90C051 figure 3.6 (2). register for port 2
56/184 toshiba corporation TMP90C051 3.6.2 port 3 (p30 - p37) port 3 is an 8-bit general-purpose i/o port (p3: memory address ffb6h). p30 - p35 are output only ports; p36 and p37 are i/o ports. the control register (p3cr: memory address ffb7h) is used to set p36 and p37 as input or output ports. reset operations set the p30 - p35 output latch to ?? and clear the p36 and p37 output latch and all control register bits to ??to set p36 and p37 to the input mode. in addition to the general-purpose i/o port function, there are also interrupt request input, chip select (cs ) and dma active (dact0 , da tc1 , ras , cas , wd6out ) output functions. (1) p30 - p34 p30 - p34 are used both as general-purpose output ports for ras , cas , cs , dact0 and dact1 . ras , cas , cs , dact0 and dact1 output is set using bits 0 - 4 of the port 3 function register (p3fr: memory address ffb8h). figure 3.6 (3). port 3 (p30 - p34)
toshiba corporation 57/184 TMP90C051 (2) p35 p35 is used both as a general-purpose output port for wdtout output. bit 1 of the watchdog timer mode register (wdmod: memory address ffddh) is used to set p35 for wdtout output. figure 3.6 (4) port 3 (p35)
58/184 toshiba corporation TMP90C051 (3) p36 p36 is used both as a general-purpose i/o port and for external interrupt request input int7. figure 3.6 (5). port 3 (p36)
toshiba corporation 59/184 TMP90C051 (4) p37 port 37 is a general-purpose i/o port. figure 3.6 (6). port 3 (p37)
60/184 toshiba corporation TMP90C051 figure 3.6 (7). registers for port 3
toshiba corporation 61/184 TMP90C051 3.6.3 port 4 (p40 - p43) port 4 is a 4-bit general-purpose i/o port (p4: memory address ffb9h), each bit of which can be set individually for input or output. the control register (bits 0 - 3 of p45cr: memory address ffbbh) is used to set the bits for input or output. reset operations clear this control register to ??to set port 4 to the input mode. this port is also used as stepping motor control/pattern generation port 0 (m00 - m03). the function register (bits 0 - 3 of p45fr: memory address ffbch) is used to select general- purpose i/o port or stepping motor control/pattern generation port. reset operations set port 4 to the general-purpose i/o mode. figure 3.6 (8). port 4
62/184 toshiba corporation TMP90C051 3.6.4 port 5 (p50 - p53) port 5 is a 4-bit general-purpose i/o port (p5: memory address ffbah), each bit of which can be set individually for input or output. the control register (bits 4 - 7 of p45cr: memory address ffbbh) is used to set the bits for input or output. reset operations clear this control register to ??to set port 5 to the input mode. this port is also used as stepping motor control/pattern generation port 1 (m10 - m13). the function register (bits 4 - 7 of p45fr: memory address ffbch) is used to select general- purpose i/o port or stepping motor control/pattern generation port. reset operations set port 5 to the general-purpose i/o mode. figure 3.6 (9). port 5
toshiba corporation 63/184 TMP90C051 figure 3.6 (10). registers for port 4, 5
64/184 toshiba corporation TMP90C051 3.6.5 port 6 (p60 - p67) port 6 is an 8-bit general-purpose i/o port (p6: memory address ffbdh), each bit of which can be set individually for input or output. the control register (p6cr: memory address ffbeh) is used to set the bits for input or output. reset operations clear all bits of the output latch and control register to ??to set port 6 to the input mode. in addition to its general-purpose i/o port function, port 6 also has interrupt request input, time clock input and timer output functions that can be speci?d with the port 6 function register (p6fr: memory address ffbfh). (1) p60 - p63 p60 - p63 are also used for external interrupt request input (int3 - i nt6). figure 3.6 (11). port 6 (p60 - p63)
toshiba corporation 65/184 TMP90C051 (2) p64 - p65 p64 and p65 are also used for 8-bit timer clock input. figure 3.6 (12). port 6 (p64 - p65)
66/184 toshiba corporation TMP90C051 (3) p66 - p67 p66 and p67 are also used for 8-bit timer 0/1, 2/3 timer output. figure 3.6 (13). port 6 (p66 - p67)
toshiba corporation 67/184 TMP90C051 figure 3.6 (14). register of port 6
68/184 toshiba corporation TMP90C051 3.7 stepping motor control/pattern generation port (p4, p5) the TMP90C051f has a built-in, timer-coupled, 4-bit, 2-channel (m0 and m1) hardware stepping motor control/pattern generation port (hereafter called smc). smc (m0 and m1) is also used as 4-bit input/output ports p4 and p5. channel 0 (m0) is coupled to 8-bit timer 0 or timer 1, and channel 1 (m1) is coupled to 8-bit timer 2 or timer 3, to alter output. smc is controlled by two control registers (p45cr and p45fr) and is used to select the stepping motor control mode and pattern generation mode. 3.7.1 control registers (1) ports 4 and 5 input/output speci?ation register (p45cr) this register is speci?s 4-bit input/output port 5 input and output in 1-bit units. all p45cr bits are cleared to ??by resets, which sets ports 4 and 5 for input. to use ports 4 and 5 as smc, set all p45cr bits to ?? for output. the p45cr register can only be written, and cannot be read. (2) ports 4 and 5 function control register (p45fr) this register is used to set ports 4 and 5 for use as smc. to use ports 4 and 5 as smc, set p45fr and p45fr4 (m1s) to ?? smc is set to the 8-bit write mode or 4-bit write mode with p45fr and p45fr . when writ- ing to smc in the 4-bit write mode, it is only possible to write to the 4-bit shift alternate register and smc func- tions as the pattern generation port. to use smc as the stepping motor control port, the method of excitation is selected with p45fr and p45fr ; p45fr and p45fr < ccw1> control the direction of rotation. (3) port 4 this is a 4-bit input/output port assigned to address ffb9. the 4 lower bits correspond to port 4 and the 4 upper bits are a shift alternate register p4 used to drive the stepping motor in the pattern gener- ation mode of with 1-2 excitations. (4) port 5 this is a 4-bit input/output port assigned to address ffba. the 4 lower bits correspond to port 5, and the 4 upper bits are a shift alternate register p5 used to drive the stepping motor in the pattern generation m ode of with 1-2 excitations.
toshiba corporation 69/184 TMP90C051 figure 3.7 (1). ports 4, 5 input/output speci?ation register (p45cr) figure 3.7 (2a). port 4 and 5 function control register (p45fr)
70/184 toshiba corporation TMP90C051 figure 3.7 (2b). port 4 and 5 function control register (p45fr) figure 3.7 (3). port 4 and 5
toshiba corporation 71/184 TMP90C051 3.7.2 pattern generation mode smc can be set to function as a pattern generation port with bits 3 and 7 (pat0 and pat1) of p45fr. in the mode, the cpu writes only to the shift alternate register; therefore, during shift trigger timer interrupt processing, it is possible to write to ports 4 and 5, and to output patterns in real time by coupling with the timer. in this mode, it is also necessary to always set p45fr1 and p45fr5 (m0m and m1m) to ?? figure 3.7 (4) shows the mode block diagram. figure 3.7 (4). pattern generation mode block diagram (port 4) in this pattern generation mode, only writing to the output latch is disabled by the hardware. all other operations are the same as for 1-2 excitations in the stepping motor control port mode. consequently, after a trigger signal from the timer, it is always necessary to write data before the next trigger signal is generated.
72/184 toshiba corporation TMP90C051 3.7.3 stepping motor control mode (1) 4-phase 1-excitation/2-excitation figure 3.7 (5) and (6) show the channel 0 output waveforms for 4-phase 1-excitation and 4-phase 2-excitation. figure 3.7 (5). 4-phase, 1-excitation output waveform (forward/reverse)
toshiba corporation 73/184 TMP90C051 figure 3.7 (6). 4-phase, 2-excitation output waveform (forward) the following is an explanation of channel 0 operation. the m0 (also used p4) output latch is shifted and output to the port at the rise of the trigger signal from the timer. the shift direction is set with p45fr5 (ccw0). the direc- tion of rotation is forward when ccw0 is ?? and is r everse (m00 ? m01 ? m02 ? m03) when ccw0 is 1. setting only one bit to 1 when making the port 4 initial setting sets 4-phase, 1-excitation; setting 2 consecutive bits to 1 sets 4-phase, 2- excitation. figure 3.7 (7) shows the block diagram. figure 3.7 (7). 4-phase, 2-excitation (forward) block diagram
74/184 toshiba corporation TMP90C051 (2) 4-phase, 2-excitation figure 3.7 (8) shows the channel 0 4-phase, 2-excita- tion output waveform figure 3.7 (8). 4-phase, 1-2 excitation output waveform (forward/reverse)
toshiba corporation 75/184 TMP90C051 the 4-phase, 1-2 excitation settings are as shown below. intial value when the initial value is rearranged as, 3 consecutive bits are set to ??and the others to ??(positive logic). for example, if b3, b7 and b2 are ?? the initial value is 10001100 and the waveform shown in figure 3.7 (8) is obtained. to obtain a negative logic output waveform, reverse the ?s?and ?s?of the initial value. for example, to obtain the waveform shown in figure 3.7 (8) with negative logic, the initial value must be 01110011. the following is an explanation of channel 0 operation. the m0 (also used as p4) output latch and stepping motor control shift alternate register (sa4) is shifted and output to the port at the rise of the trigger signal from the timer. the shift direction is set with p45fr . figure 3.7 (9) shows the block diagram. figure 3.7 (9). 4-phase, 1-2 excitation (forward) block diagram
76/184 toshiba corporation TMP90C051 setting example: setting the registers as shown below when driving channel 0 (m0) with timer 0 at 4-phase, 1-2 excitations. 3.7.4 timer trigger signals the trigger signals used with smc are not the same as the timer ?p-?p (tff1, 3) inversion trigger signals, but differ as shown in table 3.7 (1) depending on the timer operation mode. note: it is necessary to tffcr1 (ff1ie) to ??and enable tff1 inversion when smc is shifted. table 3.7 (1) using 8-bit timers 0 and 1 (same for timers 2 and 3) tff1 inversion smc shift 8-bit timer mode selected with tffcr0 (ff1is) when the up counter matches treg0 or treg1. ? 16-bit timer mode selected when the up counter matches both treg0 and treg1 (up counter value = treg*28 + treg0). ? ppg output mode selected when the up counter matches treg0 and treg1, respectively. selected when the up counter matches treg1 (ppg cycle). pwm output mode selected when the up counter matches treg0. the smc shift trigger signal is not generated.
toshiba corporation 77/184 TMP90C051 3.7.5 smc and timer output application as was explained in ?.7.4 timer trigger signal? smc shift and tff inversion timing differ depending on the timer mode. the following is a description of a typical application in which smc is operated while the 8-bit timer is operated in the ppg output mode. when driving a stepping motor, a sync signal at the excitation switchover timing is often necessary together with each phase value (smc output). in view of this, in this application the port 4 is used as the stepping motor control port and the sync clock is output to to1 (also used as p61). 4-phase, 1-excitation output waveform setting example:
78/184 toshiba corporation TMP90C051 3.8 timers the TMP90C051f has four 8-bit timers (timers 0, 1, 2 and 3). these four 8-bit timers can be operated independently or cascade connected to form two 16-bit timers. these 8-bit timers have the following four operation modes. ?8-bit internal timer modes (4) } can be combined ?16-bit interval timer modes (2) } (8 bits x 2, 16 bits x 1) ?8-bit programmable square wave (ppg: variable duty at ?ed interval) (2). ?8-bit pwm (pulse width modulation: variable duty at ?ed interval) output modes (2) figure 3.8 (1) shows the 8-bit timer (timers 0 and 1) block diagram. timers 2 and 3 have the same circuit con?uration as timers 0 and 1. the con?uration of each interval timer consists of an 8- bit up counter. 8-bit comparator and 8-bit timer register. timer ?p?ps (tff1 and tff3) are available for the timer 0 and 1 pair, and the timer 2 and 3 pair. the internal clocks ?1, ?4, ?16 and ?256 used as the input clocks to the interval timers are obtained from the 9-bit prescaler shown in figure 3.6 (2). the operating modes and timer ?p?ps for the 8-bit tim- ers are controlled by 5 control registers (to1mod, t23mod, tffcr, trun and trdc).
toshiba corporation 79/184 TMP90C051 figure 3.8 (1). timer block diagram (timers 0 and 1)
80/184 toshiba corporation TMP90C051 prescaler this 9-bit prescaler generates the clocks used for input to the 8-bit timers and baud rate generator, tph serial i/f by further dividing the fundamental clock after it has been divided by 4 (fc/4) the four clock ?t1, ?t4, ?t16 and ?t256 are used for the 8-bit timers. this prescaler can be enabled/disabled with the 5th bit trun of the timer operation control register (trun). setting to 1 starts count- ing and setting it to 0 clears and stops the timer. resets clear to 0, so the prescaler is cleared and stopped. figure 3.8 (2). prescaler
toshiba corporation 81/184 TMP90C051 up-counter this is an 8-bit binary counter that counts up in accordance with the input clock specited with the timer 0 and 1 mode register (t01mod) and timer 2 and 3 mode register (t23mod). the timer 0/timer 2 input clock can be selected from external clocks (ti0 and ti2) and the three internal clocks ?t1, ?t4 and ?t16 by setting the t01mod/ t23mod registers. the timer 1/timer 3 input clock differs depending on the operating mode. in the 16-bit timer mode, the timer 0/timer 2 output over?ow is used as the input clock. in other than the 16-bit timer mode, the input clock is selected from the internal clocks ?t1, ?t16 and ?t256 by setting the t01mod/t23mod registers, and the timer 0/timer 1 comparator output (match detec- tion). examples: if t01mod = 01, the timer 0 over?ow output is used as the timer 1 input clock (16-bit timer). if t01mod = 00, and t01mod = 01, ?t1 (8/fc) is used as the timer 1 input clock (8-bit timer). the operating mode is also set using the t01mod/ t23mod registers. and t23m1, 0> are initialized to 00 by resets. this sets the 8-bit timer mode. concerning the up counters, each interval timer can be enabled, disabled or cleared with timer operation con- trol register trun. all counters are cleared and timers are stopped by resets. a timer register these are 8-bit registers used to set interval times. when the values to which the timer registers (treg0/ treg1 and treg2/treg3) are set and the up counter value match, the comparator match detect signal becomes active. when the setting value is 00h, the match detect signal becomes active in case of an up counter over?ow. timer registers treg0/treg2 have a double-buffer contguration and these registers and buffers are used as pairs. the treg0/treg2 double buffer is enabled and disabled with and of the timer register double buffer control register (trdc). the double buffer is disabled when / = 0 and enabled when / = 1. the timing for data transfers from a register buffer to a timer register when double buffer has been enabled is determined by compare matching of pwm mode 2 n - 1 over?ow or ppg mode cycle. / are initialized to 0 by resets, which disable double buffers. when using a double buffer, write data to the timer register, set / to 1 and then write the following data to the register buffer.
82/184 toshiba corporation TMP90C051 figure 3.8 (3). timer register 0, 2 con?uration note: the timer registers and register buffers are assigned to the same memory addresses. when / = 0, the same values are written to the register buffers and timer registers. when / = 1, values are written only to the register buffers. the timer register memory addresses are as follows. treg0: ffc0h treg1: ffc1h treg2: ffc2h treg3: ffc3h these are write-only registers.
toshiba corporation 83/184 TMP90C051 figure 3.8 (4). timer 0/1 mode register (t01mod)
84/184 toshiba corporation TMP90C051 figure 3.8 (5). timer 2/3 mode register (t23mod)
toshiba corporation 85/184 TMP90C051 figure 3.8 (6). 8-bit timer flip-?p control register (tffcr)
86/184 toshiba corporation TMP90C051 figure 3.8 (7). timer operation control register (trun) figure 3.8 (8). timer register double buffer control register (trdc)
toshiba corporation 87/184 TMP90C051 ? comparator when a comparison of the up counter value and timer register values shows a match, the up counter is cleared to 0 and an interrupt (intt0-intt3) is generated. if timer ?ip-?op inversion is enabled, the timer ?ip -?op value is inverted at the same time. ? timer flip-flop this ?ip-?op is inverted by the interval timer match detect signals (comparator output) and the value can be output to the timer output pins to1 (also used a p66) and to3 (also used as p67). one each of these timer ?ip-?ops is provided for the timer 0/1 pair and the timer 2/3 pair. these timer ?ip- ?ops are called tff1 and tff3. tff1 outputs to to1 and tff3 outputs to to3. the following explains the operation of the 8-bit timers. (1) 8-bit timer mode the four 8-bit interval timers 0, 1, 2 and 3 can be used independently. the operation is the same for all and timer 1 will be used for explanatory purposes. when interrupts are generated in a fixed cycle to use timer 1 for generating interrupts (intt1) in a txed cycle, trst stop timer 1 and then load the operation mode, input clock and cycle to the t01mod treg1 reg- isters. next, enable interrupt intt1 and then start timer 1 counting. example: use the following procedure to load the registers to generate timer 1 interrupts every 40 microseconds at fc = 16mhz. refer to the table below concerning input clock selection table 3.8 (1) interrupt cycle and input clock selection using an 8-bit timer interrupt cycle (@fc = 16mhz) resolution input clock 0.5 m s ~ 128 m s 2 m s ~ 512 m s 8 m s ~ 2.048ms 128 m s ~ 32.768ms 0.5 m s 2 m s 8 m s 128 m s ?1 (8/fc) ?4 (32/fc) ?16 (8128/fc) ?256 (2048/fc)
88/184 toshiba corporation TMP90C051 outputting a 50% duty square waveform invert the timer ?ip?op at a txed cycle and output the timer ?ip?op value to the timer output pin (to1). example: use the following procedure to load the registers to output a square waveform from the to1 pin in a 3.0 microsecond cycle at fc = 16mhz. timers 0 and 1 are used in this case but timer 1 will be used here for explanatory purposes. figure 3.8 (9). square waveform (50% duty) output timing chart
toshiba corporation 89/184 TMP90C051 a starting timer 1 counting with timer 0 match output set the 8-bit timer mode and set the timer 0 comparator output as the timer 1 input clock. figure 3.8 (10) ? output inversion with software the timer ?ip?op value can be inverted regardless of timer operation. writing 00 to ff1c (bit 3 and 2 of tffcr at memory address ffc6) inverts the tff1 value. writing 00 to ff3c (bits 7 and 6 of tffcr at memory address ff3c) inverts the tff3 value. ? timer flipflop initial setting the timer ?ip?op initial value can be set to either 0 or 1 regardless of timer operation. for example, write 10 to ff1c (bits 3 and 2 of tffcr) at memory address ff1c to set tff1 to 0 and write 01 to memory address ff1c to set tff1 to 1. note: timer flip?op and timer register values cannot be read. (2) 16-bit timer mode 16-bit interval timers can be created by using timers 0 and 1 as a pair and timers 2 and 3 as a pair. timers 0 and 1, and timers 2 and 3 have the same operation, so timers 0 and 1 are used here for explanatory purposes. cascade connect timers 0 and 1 and set bits 7 and 6 of the timer 0 and 1 mode register t01mod to 00 to enable use as a 16-bit interval timer. when the 16-bit timer mode is set, the timer 0 over- ?ow is used as the timer 1 input clock regardless of the t1clk (bits 3 and 2 of t01mod) setting value. table 3.8 (2) shows the relationship between timer (interrupt) cycles and input clock selection. table 3.8 (2) 16-bit timer (interrupt) cycle and input clock selection interrupt cycle (@fc = 16mhz) resolution input clock 0.5 m s ~ 32.768ms 0.5 m s ?1 2 m s ~ 131.072ms 2 m s ?4 8 m s ~ 524.288ms 2 m s ?16
90/184 toshiba corporation TMP90C051 the timer (interrupt) cycle is set by loading the 8 lower bits to timer register treg0 and the 8 upper bits to timer register treg1. in this case, always set treg0 ?st. (comparison is temporarily halted by writing data to treg0 and comparison is started by writing data to treg1.) setting example: to generate the interrupt intt1 every 0.5s at fc = 16mhz, load the following values to treg0 and treg1. when counting using ?16 (= 8 m s @16mhz), 0.5s ? 8 m s = 62500 = f424h therefore, set treg1 = f4h, treg0 = 24h. the timer 0 comparator match detect signal is output each time the time counter uc0 and treg0 values match; however, up counter uc0 is not cleared. when the timer 1 comparator match detect signal is output at each comparator timing cycle, if up counter uc1 and treg1 match, up counters uc0 and uc1 are cleared to 0 when the match detect signals of both timer 0 and 1 comparator are output at the same time, and interrupt intt1 is generated. if inversion is enabled, the value of the timer ?ip?op tff1 is inverted. example: when treg1 = 04h, treg0 = 80h figure 3.8 (11) (3) 8-bit ppg (programmable square waveform) output mode
toshiba corporation 91/184 TMP90C051 timer 0 of timer 2 can be used to output square wave- forms of optional frequency and optional duty. the output pulses can be either low-active or high-active. t imers 0 and 3 cannot be used when this mode is set. when timer 0 is used, the output goes to to1 (also used as p66) and when timer 2 is used, the output goes to to3 (also used as p67). timer 0 will be used for explanatory purposes. (operation is the same with timer 2.) this mode outputs a programmable square waveform by inverting the timer output each time the 8-bit up counter 0 (uc0) matches timer registers (treg0 and treg1. it is necessary, however, to satisfy the condition (treg0 setting value) < (treg1 setting value). the timer 1 up counter (uc1) cannot be used in this mode but timer 1 can be used for counting by setting trun = 1. figure 3.8 (12) shows the block diagram for this mode. figure 3.8 (12). 8-bit ppg output mode block diagram
92/184 toshiba corporation TMP90C051 in this mode, the register buffer value is shifted in to treg0 by treg1 and uc0 matching when treg0 is enabled as a double buffer. a double buffer facilitates small duties (when changing the duty). example: outputting a 1/4 duty 50khz pulse (@fc = 16mhz) determining timer register setting values the frequency is set to 50khz by making a t = 1/50khz = 20 m s waveform. when ?t1 = 0.5 m s (@16mhz) is used 20 m s ? 0.5 m s = 40 therefore, timer register 0 (treg0) is set to 10 = 0ah.
toshiba corporation 93/184 TMP90C051 (4) 8-bit pwm output mode only timers 0 and 2 can be used in this mode. up to two 8-bit resolution pwm outputs are possible (pwm0 and pwm2). when timer 0 is used, the pwm waveform is output to to1 (also used as p66) and when timer 2 is used, the pwm waveform is output to to3 (also used as p67). timer 0 (pwm0) is used for explanatory purposes. (operation is the same for timer 2). timer output is inverted when the up counter (uc0) matches the timer register treg0 value and 2 n - 1 (set to n = 6, 7 or 8 with the t01mod register) counter over?ws. up counter uc0 is cleared by 2 n - 1 counter over?ws. the following conditions must be satis?d when the pwm mode is used. (timer register setting value) < (2 n - 1 counter over?w setting value) (timer register setting value) 1 0 figure 3.8 (13) shows the block diagram for this mode figure 3.8 (13). 8-bit pwm output mode block diagram
94/184 toshiba corporation TMP90C051 in this mode, the register buffer value is shifted in to treg0 by 2 n - 1 over?w detection when the treg0 double buffer is enabled. a double buffer facilitates small duties. example: outputting the pwm waveform shown below to the to1 pin using timer 0 at fc = 16mhz. setting a pwm cycle of 63.5 with m s ?1 = 0.5 m s (@fc = 16mhz) 63.5 m s ? 0.5 m s = 127 = 2 7 - 1 thus, n = 7 is set. the ?ow?level cycle is 36 m s; therefore, at ?1 = 0.5 m s 36 m s ? 0.5 m s=72 = 48h is loaded to treg0.
toshiba corporation 95/184 TMP90C051 (5) table 3.8 (4) shows the settings for each 8-bit timer mode (note) ? dont care table 3.8 (3) pwm cycle and selection of 2 n - 1 counter pwm cycle (@fc = 122.5mhz) pwm cycle (@fc = 16mhz ?1 ?4 ?16 ?1 ?4 ?16 2 6 - 1 40.3 m s 161 m s 645 m s 31.5 m s 126 m s 504 m s 2 7 - 1 81.2 m s 325 m s 1.30ms 63.5 m s 254 m s 1.01ms 2 8 - 1 163 m s 652 m s 2.61ms 127 m s 510 m s 2.04ms table 3.8 (4) setting register for each timer mode register t01mod (t23mod) tffcr bit name t10m (t23m) pwm0 (pwm2) t1clk (t3clk) t0clk (t2clk) ff1is (ff3is) function timer mode pwm cycle upper timer input clock lower timer input clock reverse signal selection of timer f/f 16-bit timer mode 01 external, ?1, ?4, ?16, (01, 10, 11) 8-bit timer x 2ch 00 external, ?1, ?4, ?16, (00, 01, 10, 11) 0: lower timer output 1: upper timer output 8-bit ppg x 1ch 10 external, ?1, ?4, ?16, (00, 01, 10, 11) 8-bit pwm x 1ch 11 2 6 - 1, 2 7 - 1, 2 8 - 1 (01, 10, 11) external, ?1, ?4, ?16, (00, 01, 10, 11) 8-bit timer x 1 ch 11 ?1, ?16, ?256, (01, 10, 11) output disenable
96/184 toshiba corporation TMP90C051 3.9 serial channels the TMP90C051f has two built-in serial input channels (ch0 and ch1) for full-duplex asynchronous communication (uart) and input/output extension. operation is the same for both channels, so channel 0 will be used for explanatory purposes. the serial channels have the following operation modes. a parity bit can be added in modes 1 and 2. mode 3 has a wake-up function with which the master controller starts the slave controller with a serial link (multi-controller system). figure 3.9 (1) shows the data format (1 frame) for each mode. figure 3.9 (1). data formats
toshiba corporation 97/184 TMP90C051 the serial channels have buffer registers for the temporary storage of transmit and receive data; therefore, transmitting and receiving can be performed independently (full duplex). in the input/output interface mode, however, the sclk (serial clock) pin is used for both transmitting and receiving, so only half duplex operation is possible. the receive buffer register has a double buffer construction to prevent over?w errors and has a one frame margin until the cpu reads the received data. that is, one buffer stores the data already received and the other buffer receives the next frame data. in the uart mode, a check function has been added that prevents the receive operation being started by mistake by the start bit due to noise. the start bit is sampled three times and the receive operation is started only when a normal start bit is detected at least two times. the inttx interrupt is generated when the transmit buffer is empty and a request for the next data to be sent is sent to the cpu. the intrx interrupt is generated when data are stored in the receive buffer and a read request is sent to the cpu. the ?gs (sccr ) are set when an overrun error, parity error or framing error occurs during the receive operation. in the input/output interface mode, sync signal (sclk) input is also possible and data can be sent and received using an external clock. (note) the serial channels have a dedicated built-in baud rate generator. any desired baud rate can be set by dividing by 2 - 16 4 clocks (?0, ?2, ?8, ?32) from the prescaler (also used for the 8-/16-bit timers). note: when transmitting and receiving using serial channel 0 in the input/output interface mode with external clock input, an external circuit and control are required for the sclk0 pin. this circuit and control are shown below.
98/184 toshiba corporation TMP90C051 3.9.1 control registers all serial channels are controlled by 4 control registers (scmod, sccr, brgcr and p2fr). transmit and receive data are stored to the scbuf register. figure 3.9 (2). serial channel mode register (scmod0/1)
toshiba corporation 99/184 TMP90C051 figure 3.9 (3). serial channel mode register (sccr0/1)
100/184 toshiba corporation TMP90C051 figure 3.9 (4). serial transmit/receive buffer register (scbuf0/1) figure 3.9 (5). baud rate generator control register (brgcr0/1)
toshiba corporation 101/184 TMP90C051 figure 3.9 (6). port 2 function register (p2fr)
102/184 toshiba corporation TMP90C051 3.9.2 con?uration figure 3.9 (7) shows the serial channel (channel 0) block dia- gram. channels 0 and 1 have the same circuit con?uration. figure 3.9 (7). serial channel (channel 0) block diagram
toshiba corporation 103/184 TMP90C051 baud rate generator the baud rate generator is a circuit that generates the transmit/receive clocks that determine the transfer speed of the serial channels. ?0 (fc/4), ?2 (fc/16), ?8 (fc/64) and ?32 (fc/256) from the 9-bit prescaler also used as a timer are used as the baud rate generator input clocks. the input clocks are selected by setting bits 5 and 4 (bg1, 0) of the baud rate generator control register brgcr. the baud rate generator has a built-in 4-bit divider. this divider determines the transfer speed by dividing by 2 ~ 16. next is the method used to calculate the baud rate when the baud rate generator is used. ?uart mode ?input/output interface mode the relationship to the input clock fundamental clock (fc) is as follows. ?0 = fc/4 ?2 = fc/16 ?8 = fc/64 ?32= fc/256 consequently, with a fundamental clock of fc = 12.288mhz, input clock ?2 (fc/16), and divider value of 5, the uart mode baud rate is as follows. = 12.288 x 10 6 ? 16 ? 5 ? 16 = 9600 (bps) table 3.9 (1) shows a typical uart mode baud rate. the serial channel baud rate can also be determined using the 8-bit timer 2. table 3.9 (2) shows a typical baud rate determined using timer 2. table 3.9 (1) baud rate selection (1) (using the baud rate generator) unit: kbps fc input clock ?0 (fc/4) ?2 (fc/16) ?8 (fc/64) ?32 (fc/256) divide value 9.8304mhz 2457.6 614.4 153.6 38.4 2 76.8 19.2 4.8 1.2 4 38.4 9.6 2.4 0.6 8 19.2 4.8 1.2 0.3 16 9.6 2.4 0.6 0.15 12.288mhz 3072.0 786.0 192.0 48.0 5 38.4 9.6 2.4 0.6 10 19.2 4.8 1.2 0.3 14.7456mhz 3686.4 921.6 230.4 57.6 3 76.8 19.2 4.8 1.2 6 38.4 9.6 2.4 0.6 12 19.2 4.8 1.2 0.3
104/184 toshiba corporation TMP90C051 table 3.9 (2) baud rate selection (2) (using timer: input clk ?1) unit: kbps fc 12.288 mhz 12 mhz 9.8304 mhz 8 mhz 6.144 mhz treg2 1h 96 76.8 62.5 48 2h 48 38.4 31.25 24 3h 32 31.25 16 4h 24 19.2 12 5h 19.2 9.6 8h 12 9.6 6 ah 9.6 4.8 10h 6 4.8 3 14h 4.8 2.4 baud rate calculation method (using timer 2) input clk of timer 2 ?1 = fc/8 ?4 = fc/32 ?16 = fc/128 serial clock generation circuit this circuit generates the basic transmit/receive clock. 1) input/output interface mode in the sccr0 = ??sclk0 output mode, the output from the baud rate generator as described above is divided by 2 to make the basic clock. in the sccr0 = ??sclk0 input mode, either the rise or fall edge, as set with the sccr0 register, is detected to make the basic clock. 2) asynchronous communication (uart) mode either the baud rate generator clock described above, the internal clock 1 (312.5k-baud @ 10mhz), or the match detect signal from timer 2 is selected, as determined by the scmod register settings, to make the basic clock (sioclk). a receive counter the receive counter is a 4-bit binary counter used in the asynchronous communication (uart) mode and is counted up by sioclk. 16 sioclk clocks are used to receive 1 bit of data and the data are sampled at the 7th, 8th and 9th clocks. the receive data are identi?d by majority logic by sampling 3 times. for example, if the data 1, 0, 1 are sampled by the 7th, 8th and 9th clocks, the data is identi?d as ?? if the values 0, 0, 1 are sampled, the data is identi?d as ?? ? receive control block 1) input/output interface mode in the sccr0 = ??sclk0 output mode, the rxd0 pin is sampled at the rise of the shift clock output to the sclk0 pin. in the sccr0 = ??sclk0 input mode, the rxd0 pin is sampled at the rise/fall of the sclk0 input in accordance with the setting of the sccr0 register. 2) asynchronous communication (uart) mode the receive control block has a start bit detection circuit that used majority logic. if ??is detected twice or more by sampling three times, the start bit is judged to be correct and receiving starts. receive data are identi?d by majority logic even while receiving data.
toshiba corporation 105/184 TMP90C051 ? receive buffers the receive buffers have a redundant construction to prevent overruns. receive data are stored 1 bit at a time to receive buffer 1 (shift register type). when 7 or 8 bits of data have been stored, the are shifted to the other receive buffer (scbuf0) and interrupt intrx is generated. the cpu reads receive buffer 2 (scbuf0). the next receive data can be stored to receive buffer 1 even before the cpu reads receive buffer 2 (scbuf0). however an overrun error will occur unless receive buffer 2 (scbuf0) is read before all bits of the next data have been received by receive buffer 1. if an overrun error occurs, the contents of receive buffer 2 and rb08 are held but the contents of receive buffer 1 are lost. in the case of 8-bit uart with parity, the parity bit is stored to sccr07 (rb08). in the case of 9-bit uart, the uppermost bit is stored to sccr0 . in the case of 9-bit uart, wake-up operation of the slave controller can be enabled by setting scmod0 to ?? after that, interrupt intrx will be gener- ated only when rb08 = 1. ? transmit counter the transmit counter is a 4-bit binary counter used in the asynchronous communication (uart) mode and, like the receive counter, is counted up by sioclk. the transmit clock txdclk is generated every 16 clocks. ? transmit control block 1) input/output interface mode in the sccr0 = ??sclk0 output mode, the transmit buffer data are output to the txd0 pin one bit at a time at the rise of the shift clock output to the sclk0 pin. in the sccr0 = ??sclk0 input mode, the transmit buffer data are output to the txd0 pin one bit at a time at the rise/fall of the sclk0 input in accordance with the setting of the sccr01(sclk0) register. 2) asynchronous communication (uart) mode when the cpu writes transmit data to the transmit buffer, transmitting starts from the next txdclk rise edge to make the transmit shift clock txdsft. hand-shake function the TMP90C051f supports a hand-shake function by the connection of cts0 and r ts0 of the other TMP90C051f. the hand-shake function allows receiving/transmitting data on a frame basis to prevent overrun errors. this function is enabled or disabled by the control register scmod0 . when the last bit (parity bit or msb) of 1-frame data is received by the receiving unit, the r ts0 pin turns to the ??level to request the transmission unit to halt transmission. when the cts0 pin turned to the ??level, the trans- mission unit halts transmission, after completing the current data transmission, until the pin turns to the ?? level. at this time, the interrupt inttx is generated, to request the cpu to transfer data. then the data is writ- ten into the transmission buffer, and the transmission unit is placed in the standby until the cts0 pin turned to the ??level. when the received data are read by the cpu, the r ts0 pin returns to the ??level, requesting that the transmission is restarted.
106/184 toshiba corporation TMP90C051 figure 3.9 (8). hand-shake function figure 3.9 (9). timing chart of rts (request to send) signal note: 1) a rise of the cts0 signal during the data transmission halts the transmission of the next data after the current data transmission. 2) the transmisison is restarted from the ?st fall of txdclk after a fall of the cts0 signal. figure 3.9 (10). hand-shake by cts (clear to send) signal
toshiba corporation 107/184 TMP90C051 3 transmission buffer the transmission buffer scbuf shifts out the data written by the cpu from the lsb as based on the shift clock txdsft (same period as txdclk) generated by the transmission control unit. when all bits are shifted out, the transmission buffer becomes empty, generating the interrupt inttx. parity control circuit setting the serial channel control register sccr to ??allows the addition of a parity bit in transmitting/ receiving data, only in the 7-bit uart or 8-bit uart mode. either even or odd parity can be selected by the sccr register. in the transmission mode, the parity is automatically generated as based on the data written into the trans- mission buffer scbuf, storing into the scbuf in the 7-bit uart mode or into in the 8-bit uart mode for transmission. and should be designated before writing data into the transmission buffer. in the receiving mode, the receiving data is shifted into the receiving buffer 1 and transferred to the receiving buffer 2 (subuf). the parity is generated from the data in the receiving buffer 2. a parity error is detected and the sccr ?g is set if the parity status mismatches the scbuf in the 7-bit uart mode or in the 8-bit uart mode. error flag there error ?gs are prepared to increase the reliability of received data. 1) overrun error (sccr0 ) overrun error occurs if all the bits of the next data are received by the receiving buffer 1 while valid data are still stored in the receiving buffer 2 (scbuf). 2) parity error (sccr0 ) the parity generated from the data that is transferred to the receiving buffer 2 (scbuf0) is compared with the parity bit received from the rxd terminal. parity error occurs if they are not equal. 3) framing error (sccr0 ) the stop bit of received data is sampled three times around the center. if a majority results in zero, framing error occurs. 11 generation timing 1) uart mode note: the occurrence of a framing error is delayed until after interruption. therefore, to check for framing error during interrupt operation, an addition operation, such as waiting for 1 bit time, becomes necessary. 2) i/o interface mode receiving mode 9 bit 8 bit + parity 8 bit, 7 bit + parity, 7 bit interrupt timing center of last bit (bit 8) center of last bit (parity bit) center of stop bit framing error timing center of stop bit center of stop bit - parity error timing center of last bit (bit 8) center of last bit (parity bit) - over-run error timing center of last bit (bit 8) center of last bit (parity bit) - transmitting mode 9-bit 8-bit + parity 8-bit, 7-bit + parity, 7-bit interrupt timing just before the stop bit ?? receiving interrupt timing of receiving just after the last sclk rising interrupt timing of transmitting -
108/184 toshiba corporation TMP90C051 3.9.3 operation (1) mode 0 (input/output interface mode) this mode is used to increase the number of TMP90C051f input/output pins. this is done by using externally connected shift registers to transmit and receive data. this mode has an sclk0 output mode in which the sync clock (sclk0) is output and an sclk0 input mode in which an external. sync clock (sclk0) is input. this mode has an sclk0 output mode in which the sync clock (sclk0) is output and sclk0 input mode in which an external sync clock (sclk0) is input. ?typical sclk0 output mode connection figure 3.9 (11). input/output interface mode
toshiba corporation 109/184 TMP90C051 transmitting in the sclk0 output mode, each time the cpu writes data to the transmit buffer, 8 bits of data are output to the txd0 pin and the sync clock is output from the sclk0 pin. when all of the data have been output, irf2 is set and interrupt inttx0 is generated. figure 3.9 (12). input/output interface mode transmit operation (sclk0 output mode) in the sclk0 input mode, 8 bits of data are output from the txd0 pin when sclk0 input is active while data are being written by the cpu to the transmit buffer. when all of the data have been output, irf2 is set and interrupt inttx0 is generated. figure 3.9 (13). input/output interface mode transmit operation (sclk0 input mode)
110/184 toshiba corporation TMP90C051 receiving in the sclk0 output mode, the sync clock is output from the sclk0 pin and the next data are shifted into receive buffer 1 each time the cpu reads the receive data and the receive interrupt ?g irfrx0 is cleared. when 8 bits of data have been received, they are shifted to receive buffer 2 (scbuf0), irf2 is again set and interrupt inttx0 is generated. figure 3.9 (14). input/output interface mode receive operation (sclk0 output mode) in the sclk0 input mode, the next data are shifted into receive buffer 1 when sckl0 input is active while the cpu is reading receive data and the receive interrupt ?g irfrx0 is cleared. when 8 bits of data have been received, they are shifted to receive buffer 2 (scbuf0), irfrx0 is again set and interrupt intrx0 is generated. figure 3.9 (15). input/output interface mode receive operation (sclk0 input mode) it is necessary to enable receiving (scmod = 1) before receiving data.
toshiba corporation 111/184 TMP90C051 (2) mode 1 (7-bit uart mode) the 7-bit uart mode is entered by setting serial channel mode register scmod0 to 01. in this mode, a parity bit can be added. the parity bit is enabled and disabled with serial channel control register sccr0 . = 1 enables parity; = 0 disables parity; and even or odd parity is selected sccr0 . setting example: the control register settings for transmitting data in the following format.
112/184 toshiba corporation TMP90C051 (3) mode 2 (8-bit uart mode) the 8-bit uart mode is entered by setting serial channel mode register scmod0 to 10. in this mode, a parity bit can be added. the parity bit is enabled and disabled with serial channel control register sccr0 . = 1 enables parity; pe = 0 dis- ables parity; and even or odd parity is selected with sccr0 . setting example: the control register settings for receiving data in the following for- mat
toshiba corporation 113/184 TMP90C051 (4) mode 3 (9-bit uart mode) the 9-bit uart mode is entered by setting serial channel mode register scmod0 to 11. in this mode, a parity bit cannot be added. the uppermost (9th) bit is written to scmod0 when transmitting and is stored to sccr0 when receiving. always start with the uppermost bit and proceed toward scbuf0 when reading or writing the buffer. w ake-up function in the 9-bit uart mode, slave controller wake-up operation is enabled by setting scmod0 to ?? interrupt intrx0 is generated when sccr0 = 1. caution: always set the txd0 pin of the slave controller to the open drainoutput mode figure 3.9 (16). serial link using the wake-up function
114/184 toshiba corporation TMP90C051 protocol set the master and slave controller to the 9-bit uart mode. set the scmod0 bit of a slave controller to ??to enable receiving. a the master controller transmits 1 frame, including the select code (8 bits) of the slave controller. the uppermost bit scmod0 is set to ??at this time. ? the slave controller receives the frames and, if its own select code matches the received data, clears the bit to ?? ? the master controller transmits data to the specified slave controller (with cleared to ??. at this time, the uppermost bit is cleared to ?? ? even with set to ?? the slave controller will neither generate interrupt intrx0 nor read receive data as long as is cleared to ?? when both and are set to ?? the slave controller will always generate interrupt intrx0 and read the receive data. then, when is cleared to ?? this is reported to the master controller to inform it that receiving has ended. setting example: serially linking two slave control- lers using internal clock ? as the transfer clock at using ch0.
toshiba corporation 115/184 TMP90C051
116/184 toshiba corporation TMP90C051 3.10 tph serial interface when copying or storing receive data, the tph (thermal printer head) serial interface converts the parallel data from mpu and dma to serial data and transmits it to the tph driver. the tph serial interface uses sio channel 0. thus, sio channel 0 has independent control registers for the serial interface mode, uart mode and input/output inter- face mode. any of these three can be selected by program. the tph serial interface mode is in effect after a reset. 3.10.1 features (1) three transmit modes can be selected. an interrupt is generated after the speci?d number of bytes has been sent. a4 mode (1728 bits): 216 bytes are sent b4 mode (2048 bits): 256 bytes are sent a3 mode (2592 bits): 324 bytes are sent (2) either an internal or external can be selected as the transmit clock. in the internal clock mode, fxtal 1/4, 1/8, 1/32, 1/ 128 baud rates can be selected. (@ fxtal = 12.5mhz: 3.125mhz/bit sent at 1/4 rate.) in the external clock mode, an external 4mhz (max.) input clock can be used. (3) tph driver and interface pins tphcko :transmit clock output pin tphsd :transmit data output pin tphla t :latch output pin ?a tw ait :tphla t output wait control input pin tphck1 :external clock input pin these pins are multiplexed internally to function as txd0, rxd0, r ts0 , cts0 and sclk0 when the input/output interface issued in the uart mode. for details, see 3.10.3 (6) operation (pin multiplexing).
toshiba corporation 117/184 TMP90C051 3.10.2 control registers (1) transmit data write register (2) tph control register note: also tmp90c51f can control the wait of tphla t output by external pin (la tw ait ).
118/184 toshiba corporation TMP90C051 (3) tph serial control register (a) the tph shift register (tph buf; byte counter) can be cleared by writing ??to d7 ~ d1. when tph serial interface transmitting has been stopped on the way, this command must be written again before writing the next transmit data. (note) write data ??to before the user uses ?stly tph serial i/f. (b) interrupt generate mode the bit is set to ??after a reset. the bit is used to select the internal interrupt generation mode (transmit interrupts [inttx0] are gener- ated only internally) or the external interrupt generation mode (started by the and of the start signal from int3 and the internal transmit interrupt enable status). = 0: internal interrupt generation mode = 1: external interrupt generation mode.
toshiba corporation 119/184 TMP90C051 3.10.3 operation (1) clock selector ?in the internal clock mode, it is possible to output the transmit clock from tphck0 and select a clock rate of ?0 (fc/4), ?1 (fc/8), t4 (fc/32), t16 (fc/128) from the internal 9 bit prescaler (timer common use) (@ xtal 12.5mhz: max. 3.125mhz/bit transfer at the 1/4 rate). ?in the external clock mode, the clock input from tphck1 is used for transmit operations (max. 4.0mhz/ bit). if a user uses the internal clock mode, operate the prescaler. (2) byte counter bits tphmod (mode = 0) of the control register (#ffeah) are used to specify the number of bytes to be transferred. the byte counter is reset to ?? after one line has been transmitted. (3) tphla t output tphla t is set to ?ow?active when the byte counter has counted the number of bytes in one line. (4) la tw ait input wait control by software or from the external pin (la tw ait ) can be used to wait for the tphla t output. waits are applied by keeping la tw ait at low active from the tphck0 fall that transmits the last bit of the last byte of the transmits data to the next tphck0 rise. (5) interrupt generation inttx0: generate at the trigger of the buffer empty after tph i/f transfer the 1 byte data intline: generate at the trigger of 1 line data end with tphlat output interrupt generation is enabled and disabled by setting the inte 1/2 register at address #ffcd/ffceh. interrupt generation is disabled after a reset. table 3.10 (1) shows the interrupt generation sources for sio channel 0. set sio channel 0 interrupts as shown below in accordance with the mode setting (operating mode). a) tph serial interface mode set the mode bit of tphmod to ?? when controlling the writing of transmit data to the tph serial interface from external pin int3, set the tphscr to ?? in this case, transmit inter- rupts are generated in accordance with the and logic of the internal transmit shift register status and external pin int3 status. when the tphscr is set to ?? transmit interrupts are generated in accordance with the internal transmit register status only. (b) uart, i/o interface mode set the tphmod to ??and the tphscr to ?? figure 3.10 (1) shows the sio channel 0 interrupt generation circuit. table 3.10 (1) serial channel 0 interrupt generation sources serial channel 0 mode uart, input/output interface mode tph mode start external internal external internal interrupt source inttx inttx inttx?nt3 inttx intrx intrx intline intline
120/184 toshiba corporation TMP90C051 figure 3.10 (1). sio channel 0 interrupt generation circuit
toshiba corporation 121/184 TMP90C051 (6) pin multiplexing table 3.10 (2) shows the multiplexing of the serial channel 0 pins. table 3.10 (2) pin multiplexing pin name pin no. after reset and in tph serial interface mode uart mode tphmod function input/ output tphmod function input/output rxd0/latwait 30 0 latwait input 1 rxd0 input txd0/tphsd 31 tphsd output txd0 output sclk0/tphcko 32 tphcko output sclk0 input/output rts0 /tphcki 33 tphcki input rts0 output cts0 /tphlat 34 tphlat output cts0 input pin name pin no. input/output interface mode (1) tphmod function input/output rxd0/latwait 30 1 rxd0 input txd0/tphsd 31 txd0 output sclk0/tphcko 32 sclk0 input...in external clock mode output...when using the internal baud rate generator rts0 /tphcki 33 rts0 output cts0 /tphlat 34 cts0 input
122/184 toshiba corporation TMP90C051 3.10.4 transmit operation timing typical transmit operations using the tph serial interface are shown below. (1) send format example 1 : a4 mode transmitting using an internal clock and external la tw ait insertion. (2) send format example 2 : b4 mode transmitting using an external clock.
toshiba corporation 123/184 TMP90C051 (3) send format example 3 (4) send format example 4
124/184 toshiba corporation TMP90C051 3.10.5 typical tph driver connections (1) using an external clock (2) using latwait and an internal clock
toshiba corporation 125/184 TMP90C051 (3) send format example 3 (4) send format example 4
126/184 toshiba corporation TMP90C051 3.11 real time clock (rtc) 3.11.1 rtc function overview 1) clock (hour, minute, second, month, day [youbi], date [hinichi], year, leap year) 2) auto-calendar 3) choice of 24-hour clock or 12-hour clock (a.m./p.m.) 4) 30 seconds correction function (software adjustment) 5) alarm output (alarm ) 6) internal interrupt generation by alarm output 3.11.2 rtc block diagram figure 3.11 (1). rtc block diagram
toshiba corporation 127/184 TMP90C051 3.11.3 rtc input/output address map and control registers table 3.11 (2) page 1 (alarm function) registers (note 1) ?is ignored when writing but is read as ?? (note 2) page is speci?d with the d0 bit (page) of #ffe7h. page = 0 sets page 0 page = 1 sets page 1 (note 3) all register bits are not initialized by reset . table 3.11 (1) page 0 (timer function) register symbol i/o address d7 d6 d5 d4 d3 d2 d1 d0 setting contents read/write secr #ffe0h (note 1) 40 seconds 20 seconds 10 seconds 8 seconds 4 seconds 2 seconds 1 seconds second r/w minr #ffe1h 40 minutes 20 minutes 10 minutes 8 minutes 4 minutes 2 minutes 1 minutes minute r/w hour #ffe2h 20 hours (pm/am) 10 hours 8 hours 4 hours 2 hours 1 hours hour r/w dayr #ffe3h w2w1w0day r/w dater #ffe4h 20 days 10 days 8 days 4 days 2 days 1 days date r/w monthr #ffe5h 10 months 8 months 4 mnonths 2 months 1 months month r/w yearr #ffe6h 80 years 40 years 20 years 10 years 8 years 4 years 2 years 1 years year (last 2 digits) r/w pager #ffe7h adjust timer en/dis alarm en/dis page page register (note 2) r/w restr #ffe8h 1hz dis/en 16hz dis/en timer rest alarm rest 0000 reset register write only symbol i/o address d7 d6 d5 d4 d3 d2 d1 d0 setting contents read/write secr #ffe0h r/w minr #ffe1h 40 minutes 20 minutes 10 minutes 8 minutes 4 minutes 2 minutes 1 minutes alarm minute r/w hour #ffe2h 20 hours (pm/am) 10 hours 8 hours 4 hours 2 hours 1 hours alarm hour r/w dayr #ffe3h w2w1w0 alarm day r/w dater #ffe4h 20 days 10 days 8 days 4 days 2 days 1 day alarm date r/w monthr #ffe5h 24/12 24-hour clock select bit r/w yearr #ffe6h leap1 leap0 leap year r/w pager #ffe7h timer en/dis alarm en/dis page page register (note 2) r/w restr #ffe8h 1hz dis/en 16hz dis/en timer rest alarm rest 0000 reset register (note 3) write only
128/184 toshiba corporation TMP90C051 3.11.4 register explanation the real timer clock (rtc) is not initialized by reset. rtc operates with unstable values after power-on; therefore, load the time, month, day, date, year and leap year to the registers before starting operation. (1) setting the second register (page 0 only)
toshiba corporation 129/184 TMP90C051 (2) setting the minute register (page 0/page1)
130/184 toshiba corporation TMP90C051 (3) setting the hour register (page 0/page 1) when d0 of ffe5h = 1 (24-hr. clock display)
toshiba corporation 131/184 TMP90C051 when d0 of ffe5h = 0 (12-hr. clock display) (4) setting the date register (page 0/page 1)
132/184 toshiba corporation TMP90C051 (5) setting the date register (page 0/page 1)
toshiba corporation 133/184 TMP90C051 (6) setting the month register (page 0 only) (7) setting 24-hour/12-hour clock (page 1 only) the mo0 bit of address #ffe5h is used to set the 24- hour/12-hour clock of the timer function .
134/184 toshiba corporation TMP90C051 (8) setting the year (last 2 digits) register (page 0 only) (9) setting the leap year register (page 1 only)
toshiba corporation 135/184 TMP90C051 (10) setting the page register (page 0/page 1) (11) setting the reset register (page 0/page 1)
136/184 toshiba corporation TMP90C051 3.11.5 alarms (1) alarm output pin any one of the following three signals can be selected with select circuit and output to the alarm pin. the alarm signal output from the comparator drops to ?ow?when the contents of the timer and alarm register match set as follows to output the alarm signal to the alarm pin. a 1hz signal obtained by dividing 32khz signal from osc with the divider is output from the alarm pin. set as follows. a a 16hz signal obtained by dividing the 32khz signal from osc with the divider is output from the alarm pin. set as follows. pager : alarm enable = 1 rester : 1hz output disable = 1 : 16hz output disable = 1 pager : alarm disable = 0 rester : 1hz output enable = 0 : 16hz output disable = 1 pager < pa2 >: alarm disable = 0 rester : 1hz output disable = 1 : 16hz output enable = 0 figure 3.11 (2). alarm select circuit
toshiba corporation 137/184 TMP90C051 (2) alarm reset cautions ??is ou tput to alarm when the timer and alarm register contents match for the minute, hour, day and date items while alarms are enabled. after an alarm reset, however, items for which nothing has been written are considered to match, regardless of the timer contents. however, the two digits (10s and units) of the minute, hour and date items form a single item, so set both digits when writing. for example, to output an alarm at the same time every day, it is only necessary to set the hour (both the 10s and units digits) and minute (both the 10s and units digits) after executing an alarm reset. an alarm reset clears the contents of the alarm register to ?? to compare ??(to compare ??for hour and minute, for example, 00 hour, 00 minute), however, all items enter the ?ont care?status when an alarm reset is executed with alarms enabled and the alarm signal is output until an alarm is set. because of that, it is necessary to disable alarms before executing an alarm reset. (3) intalarm (internal) as with alarm signal output, interrupts can be generated with any of the three following signals. 1) comparator output, 2) 1hz, 3) 16hz. interrupts are generated internally in synchronization with falls of the alarm pin output. intalarm is reset by system resets (when reset = ?ow?.
138/184 toshiba corporation TMP90C051 3.11.6 typical programming sequence (1) when reading timer data errors are possible when a carry to the next higher digit of an internal counter occurs while reading timer data. thus, use the following method to read the data correctly. figure 3.11 (3). typical timer data read sequence when reading timer data as shown in figure 3.11 (3), the timer data are read twice and the contents are then compared to determine if a carry operation a carry operation is indicated when a comparison shows that the occurred. contents differ, so the data are read again.
toshiba corporation 139/184 TMP90C051 reading timer data when alarm output was used data can be read at the alarm output rise edge by detecting alarm = 1 with a 1hz intalarm interrupt routine. (note:) this is because an rtc timer carry operation occurs at the 1hz pulse rise edge when the rtc timer is read after reading alarm = 1 from a port with an interrupt routine at *2). when reading timer data, the prescribed timer (timer value) can be read by reading for 0.5 sec. after the carry operation. figure 3.11 (4)
140/184 toshiba corporation TMP90C051 (2) when writing data data will not be written correctly if a carry signal appears while writing a series of data. use the follow- ing method to write the data correctly. the rtc contains a 15-stage divider that generates the 1hz signal from the 32.768khz signal. carry operations are not performed during the 1-s. interval after this divider is reset. data are written during this interval. figure 3.11 (5). typical data write sequence
toshiba corporation 141/184 TMP90C051 when disabling the timer writing ??to bit of address #ffe7h disables the timer, disables carry operations and prevents misoperation due to the clock hold circuit. the clock hold circuit holds once only the 1-sec- ond carry signal generated by the divider while the timer is disabled, corrects the time by outputting the carry signal to the timer after the timer is enabled, and con- tinues operating . if the timer disable continues for longer than one second, however, the timer is delayed. caution must be exercised here in that the TMP90C051f system power supply is halted while the timer is dis- abled. in this case, the timer remains stopped and the time is delayed; therefore, when a system power-down is detected while the timer is disabled, always return to timer enable and then set baken (back up enable) to ?? figure 3.11 (6). typical timer disable sequence
142/184 toshiba corporation TMP90C051 3.11.7 battery backup the rtc section has an independent (rtc) vcc power supply pin. operation can be continued in case of loss of vcc (pins 36/ 77), the main power supply, if an external battery backup is connected to (rtc) vcc. the battery backup is activated by setting buken = ?? when loss of the main power supply, vcc (pins 36/77), is detected externally. a minimum (rtc) vcc voltage of 2v is guaranteed by the battery backup. use a backup circuit that provides the same potential at (rtc) vcc found at vcc (pins 36/77) when the main power supply is on. figures 3.11 (7) and (8) below show battery backup circuit con?urations. figure 3.11 (7). nicad battery backup circuit con?uration
toshiba corporation 143/184 TMP90C051 figure 3.11 (8). lithium battery backup circuit con?uration
144/184 toshiba corporation TMP90C051 3.12 dynamic ram controller the TMP90C051f con?uration includes a controller circuit for refreshing the dynamic ram, an access circuit for reading and writing, and an address decoder circuit. figure 3.12 (1) shows the dynamic ram controller block diagram. figure 3.12 (1). dynamic ram controller block diagram 3.12.1 refresh controller block the TMP90C051f can drive ras and cas outputs used for dram refreshing. dram refresh is easy because the output cycle and out- put pulse width of the ras and cas outputs can be set by program. the refresh controller block has the following features. 1) refresh method: cas before ras interval refresh 2) refresh interval: 15 ~ 154 states (programmable) 3) refresh cycle width: 2 ~ 9 states (programmable) 4) dummy cycles can be generated.
toshiba corporation 145/184 TMP90C051 figure 3.12 (2) shows typical refresh cycle timing. figure 3.12 (2). typical refresh cycle timing the method for using the refresh controller block is described below. i) refresh method refreshing is performed using the cas and ras refresh method using the dram built-in refresh counter. ii) register setting method with the cas before ras refresh method, the refresh interval and refresh cycle width differ depending on the dram used. the TMP90C051 sets the ras and cas output in accordance with the system clock and dram used by changing the refresh control register value. figure 3.12 (3) shows the bit con?uration of the refresh control register used to control ras and cas output.
146/184 toshiba corporation TMP90C051 figure 3.12 (3). refresh control register
toshiba corporation 147/184 TMP90C051 (unit m s) table 3.12 (3) refresh cycle insertion intervals resfresh cycle insertion interval (state) frequecncy rs2 rs2 rs0 4mhz 8mhz 10mhz 12.5mhz 14mhz 16mhz 0 0 0 15 7.5 3.75 3.0 2.4 2.14 1.88 0 0 1 31 15.5 7.55 6.2 4.96 4.43 3.88 0 1 0 62 31.0 15.5 12.4 9.92 8.86 7.75 0 1 1 78 39.0 19.5 15.6 12.48 11.14 9.75 1 0 0 97 48.5 24.25 19.4 15.52 13.86 12.13 1 0 1 109 54.5 27.25 21.8 17.44 15.57 13.63 1 1 0 124 62.0 31.0 24.8 19.84 17.72 15.5 15.5 1 1 154 77.0 38.5 30.8 24.7 22.0 19.3 the refresh control register (refcr) is assigned to address ffd8h and the bits are as follows. : dummy cycle control bit (dmi) the dummy cycles required fro dram intialization are genrated by setting this bit to ??(see figure 3.12 (4)). : refresh cycle insertion interval control bits (rs2 ~ rs0) these 3 bits are used to change the system clock used and the insertion interval. example: when using the 12.5mhz system clock, set these bits to ?00?to specify a dram refresh cycle of 16 microseconds. : refresh cycle width control bits (rw2 ~ rw0) these 3 bits are used to change the refresh cycle width (ras, cas output) (2 ~ 9 states). : refresh cycle control bit (rc) this bit is used to control refresh cycle insertion.
148/184 toshiba corporation TMP90C051 figure 3.12 (4). port 3 function registers iii) dynamic ram initialize the dynamic ram controller generates consecutive cas before ras dummy cycles when using dram. figure 3.12 (4) shows the cas before ras dummy cycle timing. figure 3.12 (5) cas before ras dummy cycle timing
toshiba corporation 149/184 TMP90C051 3.12.2 read/write control block the read/write control block outputs the memory access cycle ras and cas signals when the address area set with the decoder block described in the next section is selected. figure 3.12 (6) shows the ras and cas output timing during the memory access cycle. figure 3.12 (6). memory access cycle timing
150/184 toshiba corporation TMP90C051 i) register setting method figure 3.4 (7) shows the bit con?uration of the memory access control register. the memory access control register (macr) is assigned to address ffdbh. cs output is enabled and disabled by setting . additionally, ras and cas output during memory access is enabled and disabled by setting . when is set to ??(cs output disable), ras and cas output during memory access is disabled, regardless of value. figure 3.12 (7). memory access control register (macr)
toshiba corporation 151/184 TMP90C051 3.12.3 address decoder block the address decoder block enables dram access and simul- taneously outputs the cs signal when the start address and mask address are loaded to the register. when a dram is not used, the cs signal can be used as the area select signal. figure 3.12 (8). chip select (cs ) operation timing figure 3.12 (9). address decoder block diagram
152/184 toshiba corporation TMP90C051 ii) start address setting method the address decoder outputs the cs signal when the start address and area size are speci?d. as shown in the diagram, the start address is decoded by a15 - a22 and is therefore set every 32k bytes. in other words, the dram start address is set every 32k bytes, starting at 000000h. the start address is changed to set the value of msamr register. figure 3.12 (10). start address setting locations iii) address area setting method the address area is speci?d by setting the start address mask register (msamr). as can be seen from the address decoder block diagram (fig. 3.12 (9), the address area that can output cs is speci?d depending on whether or not the a14 - a21 address values are compared. in other words, it is possible to specify an area of up to 4m bytes in 16k byte units. iii) procedures for setting start address/address area (1) set the memory start address mask register (msamr) (setting the address area) (2) set the memory start address mask register (msar) (setting the area start address) (3) compare values of the same address bit of msamr and msar. (ex.) compare values of msamr and msar . (4) if the values of the same address bit are ?? the bit in msar becomes ineffective and is regarded as ?? the start address is changed. if the values of the same address bit are not matched by ?? the set-up is complete. (the speci?d address area and start address are decoded.) (5) when the start address is changed correctly, the set-up is complete. if not so, change the msar value. (6) set msar again and compare. (start from (3).)
toshiba corporation 153/184 TMP90C051 set-up example when address area = 64k bytes, start address = 18000 h (memory map: 18000 h to 27fff h ) set msamr = 03 h <-> address area: 64k bytes msar = 03 h <-> start address: 18000 h *: when values of the same address bit are ?? the start address is changed to 10000 h . if not so, change the start address to 20000 h . (memory map: 20000 h to 2ffff h ) msamr =03 h msar = 04 h when the start address is 20000 h , the address bits do not match as ??and the start address is not changed. this enables to decode under the start address = 20000 h and the address area = 64k bytes. (set-up example 1) case of msar = 03 h and msamr = 03 h the output of chip selection is the memory map as below. v22 ~ v16 = ?? so these values of s22 ~ s16 are valid- ness but v15 and v14 = ?? so these values of s15 and s14 are invalidity.
154/184 toshiba corporation TMP90C051 (set-up example 2) case of msar = 03h and msamr = 02h v22 ~ v16, v14 = ?? so these value of s22 ~ s16 and s14 are validness but s15 = ?? so this value of s15 is invalidity.
toshiba corporation 155/184 TMP90C051 (set-up example 3) chip select area by setting value of msar and msamr (partly) msamr msar 00 01 02 03 00 0000 3fff (16k byte) 0000 7fff (32k byte) 0000 8000 3fff 1bfff (16k byte x 2) 0000 ffff (64k byte) 01 8000 bfff (16k byte) 8000 ffff (32k byte) 10000 18000 3fff 1bfff (16k byte x 2) 0000 ffff (64k byte) 02 10000 13fff (16k byte) 10000 17fff (32k byte) 10000 18000 13fff 1bfff (16k byte x 2) 10000 1ffff (64k byte) 03 18000 1bfff (16k byte) 18000 1ffff (32k byte) 10000 18000 13fff 1bfff (16k byte x 2) 10000 1ffff (64k byte) msamr msar 03 07 0f 1f 3f 7f ff 04 20000 2ffff (64k byte) 20000 3ffff (128k byte) 00000 3ffff (256k byte) 00000 7ffff (512k byte) 00000 fffff (1m byte) 00000 1fffff (2m byte) 00000 3fffff (4m byte) 08 40000 4ffff (64k byte) 40000 5ffff (128k byte) 40000 7ffff (256k byte) 10 80000 8ffff (64k byte) 80000 9ffff (128k byte) 80000 bffff (256k byte) 80000 ffff (512k byte) 20 100000 10ffff (64k byte) 100000 11ffff (128k byte) 100000 13ffff (256k byte) 100000 17ffff (512k byte) 100000 1fffff (1m byte) 40 200000 20ffff (64k byte) 200000 21ffff (128k byte) 200000 23ffff (256k byte) 200000 27ffff (512k byte) 200000 2ffff (1m byte) 200000 3fffff (2m byte) 80 400000 40ffff (64k byte) 400000 41ffff (128k byte) 400000 43ffff (256k byte) 400000 47ffff (512k byte) 400000 4fffff (1m byte) 400000 5fffff (2m byte) 400000 7fffff (4m byte) ( ) is area size
156/184 toshiba corporation TMP90C051 iv) register setting method figure 3.12 (11) and figure 3.12 (12) show the bit con- ?urations of the start address register (msar) and start address mask register (msamr). msar is assigned to address ffd9h and msamr is assigned to address ffdah. cs output can be enabled and disabled regardless of the above registers by setting of the memory access control register (macr) shown in figure 3.12 (6). figure 3.12 (11). memory start address mask register the msar ~ correspond to the a22 ~ a15 of address and the s14 correspond to the a14 (s14 is ??at default). the msamr ~ point to the validness/invalidity of comparison with the value of the setting msar and the address. the msamr ~ correspond to the msamr ~ , s14 and the msamr corresponds to the msar (s22 is ??at default). the comparison of the a22 and is usually validness. the meaning of comparison (valid- ness and invalidity). ex. the case of invalidity at = 1 the comparison of value and address (a15) is invalidity and value is validity. so the value of a15 is unrelated ness for ???? the case of validness at = 0 the comparison of value and address (a15) is validness. when the value of only agree with address (a15), cs signal is enabled.
toshiba corporation 157/184 TMP90C051 3.12.4 priority sequence since the dynamic ram refresh cycle is asynchronous with the cpu operation cycle, it may overlap the read/write cycle in some cases. in such cases, the dynamic ram controller gives priority to the cycle that enters ?st. when the refresh cycle is given priority, a waits automatically inserted in the memory access cycle. figure 3.12 (13) shows the timing in such cases. . figure 3.12 (13). timing chart for when a memory access cycle enters during a refresh cycle
158/184 toshiba corporation TMP90C051 3.12.5 typical dram connection figure 3.12 (14). typical dram connection


▲Up To Search▲   

 
Price & Availability of TMP90C051

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X